diff --git a/.circleci/config.yml b/.circleci/config.yml index 357b068edf86..10d3e1544a64 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,6 +15,15 @@ commands: # a reusable command with parameters - source-v2- # Machine Setup # If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each + - run: + name: Install Headless Chrome dependencies + command: | + sudo apt-get update && sudo apt-get install -yq \ + gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \ + libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \ + libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 \ + libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates \ + fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm1 # The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out. - checkout # Prepare for artifact and test results collection equivalent to how it was done on 1.0. diff --git a/.github/workflows/check-supported-versions.yaml b/.github/workflows/check-supported-versions.yaml index a76a1b837051..350c008e9004 100644 --- a/.github/workflows/check-supported-versions.yaml +++ b/.github/workflows/check-supported-versions.yaml @@ -24,7 +24,7 @@ jobs: uses: actions/checkout@v3 - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: ${{ matrix.java }} diff --git a/.github/workflows/gradle-test.yaml b/.github/workflows/gradle-test.yaml index a5c021cdba50..09ad3815645c 100644 --- a/.github/workflows/gradle-test.yaml +++ b/.github/workflows/gradle-test.yaml @@ -34,7 +34,7 @@ jobs: - samples/client/petstore/java/okhttp-gson steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 11 diff --git a/.github/workflows/openapi-generator.yaml b/.github/workflows/openapi-generator.yaml index 2021fbc8916e..bd062d7d037e 100644 --- a/.github/workflows/openapi-generator.yaml +++ b/.github/workflows/openapi-generator.yaml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up JDK 8 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: 8 distribution: 'temurin' @@ -53,7 +53,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up JDK 8 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: 8 distribution: 'temurin' @@ -88,7 +88,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up JDK 8 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: 8 distribution: 'temurin' @@ -127,7 +127,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up JDK 8 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: 8 distribution: 'temurin' @@ -162,7 +162,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: 11 distribution: 'temurin' @@ -195,7 +195,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: 11 distribution: 'temurin' diff --git a/.github/workflows/samples-dart.yaml b/.github/workflows/samples-dart.yaml index cdc546175675..e413e1da5846 100644 --- a/.github/workflows/samples-dart.yaml +++ b/.github/workflows/samples-dart.yaml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 8 @@ -51,7 +51,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 8 diff --git a/.github/workflows/samples-groovy.yaml b/.github/workflows/samples-groovy.yaml index 7263f198f5d3..e9c1f791aad9 100644 --- a/.github/workflows/samples-groovy.yaml +++ b/.github/workflows/samples-groovy.yaml @@ -22,7 +22,7 @@ jobs: - samples/client/petstore/groovy steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 8 diff --git a/.github/workflows/samples-java-client-jdk11.yaml b/.github/workflows/samples-java-client-jdk11.yaml index 91478fc371c0..30198191d235 100644 --- a/.github/workflows/samples-java-client-jdk11.yaml +++ b/.github/workflows/samples-java-client-jdk11.yaml @@ -39,7 +39,7 @@ jobs: - samples/client/petstore/java/jersey1 steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 11 diff --git a/.github/workflows/samples-java-play-framework.yaml b/.github/workflows/samples-java-play-framework.yaml index 8498b1bdc8ee..083f003073e7 100644 --- a/.github/workflows/samples-java-play-framework.yaml +++ b/.github/workflows/samples-java-play-framework.yaml @@ -30,7 +30,7 @@ jobs: - samples/server/petstore/java-play-framework-no-wrap-calls steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 11 diff --git a/.github/workflows/samples-jaxrs.yaml b/.github/workflows/samples-jaxrs.yaml index b7ef9bbdb1ca..8e5e77cd8da8 100644 --- a/.github/workflows/samples-jaxrs.yaml +++ b/.github/workflows/samples-jaxrs.yaml @@ -40,7 +40,7 @@ jobs: - samples/server/petstore/jaxrs-cxf-non-spring-app steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 8 diff --git a/.github/workflows/samples-kotlin-client.yaml b/.github/workflows/samples-kotlin-client.yaml index 0eb2494b8120..009733cce67a 100644 --- a/.github/workflows/samples-kotlin-client.yaml +++ b/.github/workflows/samples-kotlin-client.yaml @@ -41,7 +41,7 @@ jobs: - samples/client/petstore/kotlin-array-simple-string steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 8 diff --git a/.github/workflows/samples-kotlin-server.yaml b/.github/workflows/samples-kotlin-server.yaml index 2b1ce76c3ef8..ad5111234088 100644 --- a/.github/workflows/samples-kotlin-server.yaml +++ b/.github/workflows/samples-kotlin-server.yaml @@ -31,7 +31,7 @@ jobs: #- samples/server/petstore/kotlin-vertx-modelMutable steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 8 diff --git a/.github/workflows/samples-scala.yaml b/.github/workflows/samples-scala.yaml index 041640421345..9b91e8ca2b29 100644 --- a/.github/workflows/samples-scala.yaml +++ b/.github/workflows/samples-scala.yaml @@ -27,7 +27,7 @@ jobs: - samples/server/petstore/scala-finch # cannot be tested with jdk11 steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 8 diff --git a/.github/workflows/samples-spring.yaml b/.github/workflows/samples-spring.yaml index 29eb25c89a38..aa3371a9b075 100644 --- a/.github/workflows/samples-spring.yaml +++ b/.github/workflows/samples-spring.yaml @@ -42,7 +42,7 @@ jobs: - samples/openapi3/server/petstore/spring-boot-oneof steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 8 diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index a256fc200c10..4df69baebf76 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 11 diff --git a/README.md b/README.md index c4b1a04b267a..d068ec7671e1 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se | | Languages/Frameworks | | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient, Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 11.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs) | +| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient, Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 13.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs) | | **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) | | **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** | | **Configuration files** | [**Apache2**](https://httpd.apache.org/) | @@ -841,6 +841,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - 2022-01-02 - [Towards a secure API client generator for IoT devices](https://arxiv.org/abs/2201.00270) by Anders Aaen Springborg, Martin Kaldahl Andersen, Kaare Holland Hattel, Michele Albano - 2022-02-02 - [Use OpenApi generator to share your models between Flutter and your backend](https://www.youtube.com/watch?v=kPW7ccu9Yvk) by [Guillaume Bernos](https://feb2022.fluttervikings.com/speakers/guillaume_bernos) at [Flutter Vikings Conference 2022 (Hybrid)](https://feb2022.fluttervikings.com/) - 2022-03-15 - [OpenAPI Specでハイフン区切りのEnum値をOpenAPI Generatorで出力すると、ハイフン区切りのまま出力される](https://qiita.com/yuji38kwmt/items/824d74d4889055ab37d8) by [yuji38kwmt](https://qiita.com/yuji38kwmt) +- 2022-04-01 - [OpenAPI Generatorのコード生成とSpring Frameworkのカスタムデータバインディングを共存させる](https://techblog.zozo.com/entry/coexistence-of-openapi-and-spring) in [ZOZO Tech Blog](https://techblog.zozo.com/) ## [6 - About Us](#table-of-contents) diff --git a/appveyor.yml b/appveyor.yml index 85b45d481329..6c136913908b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -101,15 +101,8 @@ test_script: # test ps petstore - ps: | - $ErrorActionPreference = "Stop" cd samples\client\petstore\powershell\ - .\Build.ps1 - Import-Module -Name '.\src\PSPetstore' - $Result = Invoke-Pester -PassThru - if ($Result.FailedCount -gt 0) { - $host.SetShouldExit($Result.FailedCount) - exit $Result.FailedCount - } + .\CIRunTest.ps1 cache: - C:\maven\ - C:\gradle\ diff --git a/bin/configs/dart-dio-next-petstore-client-lib-fake.yaml b/bin/configs/dart-dio-next-petstore-client-lib-fake.yaml index edcc346a19fe..0f8885e6a73c 100644 --- a/bin/configs/dart-dio-next-petstore-client-lib-fake.yaml +++ b/bin/configs/dart-dio-next-petstore-client-lib-fake.yaml @@ -8,3 +8,4 @@ typeMappings: EnumClass: "ModelEnumClass" additionalProperties: hideGenerationTimestamp: "true" + enumUnknownDefaultCase: "true" diff --git a/bin/configs/dart-dio-petstore-client-lib.yaml b/bin/configs/dart-dio-petstore-client-lib.yaml index 8db24ccb0cec..929f403957a4 100644 --- a/bin/configs/dart-dio-petstore-client-lib.yaml +++ b/bin/configs/dart-dio-petstore-client-lib.yaml @@ -4,3 +4,4 @@ inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml templateDir: modules/openapi-generator/src/main/resources/dart-dio additionalProperties: hideGenerationTimestamp: "true" + enumUnknownDefaultCase: "true" diff --git a/bin/configs/java-jersey3.yaml b/bin/configs/java-jersey3.yaml new file mode 100644 index 000000000000..50ea3258eca4 --- /dev/null +++ b/bin/configs/java-jersey3.yaml @@ -0,0 +1,13 @@ +generatorName: java +outputDir: samples/client/petstore/java/jersey3 +library: jersey3 +inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + artifactId: petstore-jersey3 + hideGenerationTimestamp: true + serverPort: "8082" + dateLibrary: java8 + useOneOfDiscriminatorLookup: true + disallowAdditionalPropertiesIfNotPresent: false + gradleProperties: "\n# JVM arguments\norg.gradle.jvmargs=-Xmx2024m -XX:MaxPermSize=512m\n# set timeout\norg.gradle.daemon.idletimeout=3600000\n# show all warnings\norg.gradle.warning.mode=all" diff --git a/bin/configs/powershell.yaml b/bin/configs/powershell.yaml index c31d09aa13c3..9a408c2ad176 100644 --- a/bin/configs/powershell.yaml +++ b/bin/configs/powershell.yaml @@ -1,6 +1,6 @@ generatorName: powershell outputDir: samples/client/petstore/powershell -inputSpec: modules/openapi-generator/src/test/resources/3_0/powershell/petstore.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/powershell/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml templateDir: modules/openapi-generator/src/main/resources/powershell additionalProperties: packageGuid: a27b908d-2a20-467f-bc32-af6f3a654ac5 diff --git a/bin/configs/typescript-consolidated-browser.yaml b/bin/configs/typescript-consolidated-browser.yaml new file mode 100644 index 000000000000..8ea49d065b2b --- /dev/null +++ b/bin/configs/typescript-consolidated-browser.yaml @@ -0,0 +1,10 @@ +generatorName: typescript +outputDir: samples/openapi3/client/petstore/typescript/builds/browser +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/typescript +additionalProperties: + framework: fetch-api + npmName: ts-petstore-client + projectName: ts-petstore-client + moduleName: petstore + supportsES6: true diff --git a/bin/configs/typescript-with-unique-items.yaml b/bin/configs/typescript-consolidated-with-unique-items.yaml similarity index 100% rename from bin/configs/typescript-with-unique-items.yaml rename to bin/configs/typescript-consolidated-with-unique-items.yaml diff --git a/docs/generators/java.md b/docs/generators/java.md index 5184e5f56f7b..d2988169c0f5 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -52,7 +52,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |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|
**jersey1**
HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libraries instead.
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x
**feign**
HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x.
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**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
**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
**apache-httpclient**
HTTP client: Apache httpclient 4.x
|okhttp-gson| +|library|library template (sub-template) to use|
**jersey1**
HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey3' or other HTTP libraries instead.
**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.
**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
**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
**apache-httpclient**
HTTP client: Apache httpclient 4.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| @@ -78,7 +78,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, libraries| |false| |useBeanValidation|Use BeanValidation API annotations| |false| |useGzipFeature|Send gzip-encoded requests| |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, native, okhttp-gson support this option.| |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| |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| |false| diff --git a/modules/openapi-generator-gradle-plugin/README.adoc b/modules/openapi-generator-gradle-plugin/README.adoc index 51f6e08e15f9..d904f4150817 100644 --- a/modules/openapi-generator-gradle-plugin/README.adoc +++ b/modules/openapi-generator-gradle-plugin/README.adoc @@ -204,6 +204,11 @@ apply plugin: 'org.openapi.generator' |None |Suffix that will be appended to all model names. +|apiNameSuffix +|String +|None +|Suffix that will be appended to all api names. + |instantiationTypes |Map(String,String) |None diff --git a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/OpenApiGeneratorPlugin.kt b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/OpenApiGeneratorPlugin.kt index be865049c770..21436595abd1 100644 --- a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/OpenApiGeneratorPlugin.kt +++ b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/OpenApiGeneratorPlugin.kt @@ -106,6 +106,7 @@ class OpenApiGeneratorPlugin : Plugin { modelPackage.set(generate.modelPackage) modelNamePrefix.set(generate.modelNamePrefix) modelNameSuffix.set(generate.modelNameSuffix) + apiNameSuffix.set(generate.apiNameSuffix) instantiationTypes.set(generate.instantiationTypes) typeMappings.set(generate.typeMappings) additionalProperties.set(generate.additionalProperties) diff --git a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/extensions/OpenApiGeneratorGenerateExtension.kt b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/extensions/OpenApiGeneratorGenerateExtension.kt index 46aa9540cfa3..69002705d11c 100644 --- a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/extensions/OpenApiGeneratorGenerateExtension.kt +++ b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/extensions/OpenApiGeneratorGenerateExtension.kt @@ -106,6 +106,11 @@ open class OpenApiGeneratorGenerateExtension(project: Project) { */ val modelNameSuffix = project.objects.property() + /** + * Suffix that will be appended to all api names. Default is the empty string. + */ + val apiNameSuffix = project.objects.property() + /** * Sets instantiation type mappings. */ @@ -326,6 +331,7 @@ open class OpenApiGeneratorGenerateExtension(project: Project) { releaseNote.set("Minor update") modelNamePrefix.set("") modelNameSuffix.set("") + apiNameSuffix.set("") generateModelTests.set(true) generateModelDocumentation.set(true) generateApiTests.set(true) diff --git a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt index d7a0c989de2a..cd693b17136b 100644 --- a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt +++ b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt @@ -168,6 +168,13 @@ open class GenerateTask : DefaultTask() { @Input val modelNameSuffix = project.objects.property() + /** + * Suffix that will be appended to all api names. Default is the empty string. + */ + @Optional + @Input + val apiNameSuffix = project.objects.property() + /** * Sets instantiation type mappings. */ @@ -573,6 +580,10 @@ open class GenerateTask : DefaultTask() { configurator.setModelNameSuffix(value) } + apiNameSuffix.ifNotEmpty { value -> + configurator.setApiNameSuffix(value) + } + invokerPackage.ifNotEmpty { value -> configurator.setInvokerPackage(value) } diff --git a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskDslTest.kt b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskDslTest.kt index f8871e12fae8..14c8f358f1bb 100644 --- a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskDslTest.kt +++ b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskDslTest.kt @@ -68,6 +68,55 @@ class GenerateTaskDslTest : TestBase() { "Expected a successful run, but found ${result.task(":openApiGenerate")?.outcome}") } + @Test + fun `should apply prefix & suffix config parameters`() { + // Arrange + val projectFiles = mapOf( + "spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0.yaml") + ) + withProject(""" + plugins { + id 'org.openapi.generator' + } + openApiGenerate { + generatorName = "java" + inputSpec = file("spec.yaml").absolutePath + outputDir = file("build/java").absolutePath + apiPackage = "org.openapitools.example.api" + invokerPackage = "org.openapitools.example.invoker" + modelPackage = "org.openapitools.example.model" + modelNamePrefix = "ModelPref" + modelNameSuffix = "Suff" + apiNameSuffix = "ApiClassSuffix" + configOptions = [ + dateLibrary: "java8" + ] + } + """.trimIndent(), projectFiles) + + // Act + val result = GradleRunner.create() + .withProjectDir(temp) + .withArguments("openApiGenerate") + .withPluginClasspath() + .build() + + // Assert + assertTrue(result.output.contains("Successfully generated code to"), "User friendly generate notice is missing.") + + listOf( + "build/java/src/main/java/org/openapitools/example/model/ModelPrefPetSuff.java", + "build/java/src/main/java/org/openapitools/example/model/ModelPrefErrorSuff.java", + "build/java/src/main/java/org/openapitools/example/api/PetsApiClassSuffix.java" + ).map { + val f = File(temp, it) + assertTrue(f.exists() && f.isFile, "An expected file was not generated when invoking the generation. - " + f) + } + + assertEquals(TaskOutcome.SUCCESS, result.task(":openApiGenerate")?.outcome, + "Expected a successful run, but found ${result.task(":openApiGenerate")?.outcome}") + } + @Test fun `openApiGenerate should used up-to-date instead of regenerate`() { // Arrange diff --git a/modules/openapi-generator-maven-plugin/README.md b/modules/openapi-generator-maven-plugin/README.md index 3102d196ffa3..a9b551e834e1 100644 --- a/modules/openapi-generator-maven-plugin/README.md +++ b/modules/openapi-generator-maven-plugin/README.md @@ -67,6 +67,7 @@ mvn clean compile | `library` | `openapi.generator.maven.plugin.library` | library template (sub-template) | `modelNamePrefix` | `openapi.generator.maven.plugin.modelNamePrefix` | Sets the prefix for model classes and enums | `modelNameSuffix` | `openapi.generator.maven.plugin.modelNameSuffix` | Sets the suffix for model classes and enums +| `apiNameSuffix` | `openapi.generator.maven.plugin.apiNameSuffix` | Sets the suffix for api classes | `ignoreFileOverride` | `openapi.generator.maven.plugin.ignoreFileOverride` | specifies the full path to a `.openapi-generator-ignore` used for pattern based overrides of generated outputs | `httpUserAgent` | `openapi.generator.maven.plugin.httpUserAgent` | Sets custom User-Agent header value | `removeOperationIdPrefix` | `openapi.generator.maven.plugin.removeOperationIdPrefix` | remove operationId prefix (e.g. user_getName => getName) diff --git a/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java b/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java index bc32b412f628..2435aab27f33 100644 --- a/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java +++ b/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java @@ -220,6 +220,12 @@ public class CodeGenMojo extends AbstractMojo { @Parameter(name = "modelNameSuffix", property = "openapi.generator.maven.plugin.modelNameSuffix") private String modelNameSuffix; + /** + * Sets the suffix for api classes + */ + @Parameter(name = "apiNameSuffix", property = "openapi.generator.maven.plugin.apiNameSuffix") + private String apiNameSuffix; + /** * Sets an optional ignoreFileOverride path */ @@ -596,6 +602,10 @@ public void execute() throws MojoExecutionException { configurator.setModelNameSuffix(modelNameSuffix); } + if (isNotEmpty(apiNameSuffix)) { + configurator.setApiNameSuffix(apiNameSuffix); + } + if (null != templateDirectory) { configurator.setTemplateDir(templateDirectory.getAbsolutePath()); } 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 dd2083d017e3..4dea86da7dc1 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 @@ -46,6 +46,7 @@ public void testCommonConfiguration() throws Exception { mojo.execute(); assertEquals("java", getVariableValueFromObject(mojo, "generatorName")); assertEquals("jersey2", getVariableValueFromObject(mojo, "library")); + assertEquals("Suffix", getVariableValueFromObject(mojo, "apiNameSuffix")); assertEquals("remote.org.openapitools.client.api", getVariableValueFromObject(mojo, "apiPackage")); assertEquals("remote.org.openapitools.client.model", getVariableValueFromObject(mojo, "modelPackage")); assertEquals("remote.org.openapitools.client", getVariableValueFromObject(mojo, "invokerPackage")); diff --git a/modules/openapi-generator-maven-plugin/src/test/resources/default/pom.xml b/modules/openapi-generator-maven-plugin/src/test/resources/default/pom.xml index 95ab2451e5d8..277b183629df 100644 --- a/modules/openapi-generator-maven-plugin/src/test/resources/default/pom.xml +++ b/modules/openapi-generator-maven-plugin/src/test/resources/default/pom.xml @@ -34,6 +34,7 @@ joda + Suffix jersey2 ${basedir}/target/generated-sources/common-maven/remote-openapi remote.org.openapitools.client.api diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java index 1de4db324a6e..2c8dcdb681fa 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java @@ -29,6 +29,7 @@ import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationsMap; import java.io.File; import java.util.List; @@ -194,7 +195,7 @@ public interface CodegenConfig { ModelsMap postProcessModels(ModelsMap objs); - Map postProcessOperationsWithModels(Map objs, List allModels); + OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels); Map postProcessSupportingFileData(Map objs); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java index 25f53be09fb8..15322f446969 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java @@ -989,17 +989,17 @@ hasChildren, isMap, isDeprecated, hasOnlyReadOnly, getExternalDocumentation(), g @Override public String toString() { final StringBuilder sb = new StringBuilder("CodegenModel{"); - sb.append("parent='").append(parent).append('\''); + sb.append("name='").append(name).append('\''); + sb.append(", parent='").append(parent).append('\''); sb.append(", parentSchema='").append(parentSchema).append('\''); sb.append(", interfaces=").append(interfaces); + sb.append(", interfaceModels=").append(interfaceModels!=null?interfaceModels.size():"[]"); sb.append(", allParents=").append(allParents); sb.append(", parentModel=").append(parentModel); - sb.append(", interfaceModels=").append(interfaceModels); - sb.append(", children=").append(children); + sb.append(", children=").append(children!=null?children.size():"[]"); sb.append(", anyOf=").append(anyOf); sb.append(", oneOf=").append(oneOf); sb.append(", allOf=").append(allOf); - sb.append(", name='").append(name).append('\''); sb.append(", classname='").append(classname).append('\''); sb.append(", title='").append(title).append('\''); sb.append(", description='").append(description).append('\''); 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 2e1b2e6fa5b2..349c108cb2fa 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 @@ -40,6 +40,7 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.serializer.SerializerUtils; import org.openapitools.codegen.templating.MustacheEngineAdapter; import org.openapitools.codegen.templating.mustache.*; @@ -810,7 +811,7 @@ public void postProcess() { // override with any special post-processing @Override @SuppressWarnings("static-method") - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { return objs; } @@ -3192,7 +3193,7 @@ protected CodegenDiscriminator createDiscriminator(String schemaName, Schema sch // FIXME: for now, we assume that the discriminator property is String discriminator.setPropertyType(typeMapping.get("string")); discriminator.setMapping(sourceDiscriminator.getMapping()); - List uniqueDescendants = new ArrayList(); + List uniqueDescendants = new ArrayList<>(); if (sourceDiscriminator.getMapping() != null && !sourceDiscriminator.getMapping().isEmpty()) { for (Entry e : sourceDiscriminator.getMapping().entrySet()) { String name; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index fbccba22f1a4..520a4a196a3b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -44,8 +44,11 @@ import org.openapitools.codegen.languages.PythonExperimentalClientCodegen; import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; +import org.openapitools.codegen.model.ApiInfoMap; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.serializer.SerializerUtils; import org.openapitools.codegen.templating.CommonTemplateContentLocator; import org.openapitools.codegen.templating.GeneratorTemplateContentLocator; @@ -541,7 +544,7 @@ void generateModels(List files, List allModels, List unu } @SuppressWarnings("unchecked") - void generateApis(List files, List allOperations, List allModels) { + void generateApis(List files, List allOperations, List allModels) { if (!generateApis) { // TODO: Process these anyway and present info via dryRun? LOGGER.info("Skipping generation of APIs."); @@ -566,7 +569,7 @@ void generateApis(List files, List allOperations, List a try { List ops = paths.get(tag); ops.sort((one, another) -> ObjectUtils.compare(one.operationId, another.operationId)); - Map operation = processOperations(config, tag, ops, allModels); + OperationsMap operation = processOperations(config, tag, ops, allModels); URL url = URLPathUtils.getServerURL(openAPI, config.serverVariableOverrides()); operation.put("basePath", basePath); operation.put("basePathWithoutHost", removeTrailingSlash(config.encodePath(url.getPath()))); @@ -595,9 +598,8 @@ void generateApis(List files, List allOperations, List a if (config.vendorExtensions().containsKey("x-group-parameters")) { boolean isGroupParameters = Boolean.parseBoolean(config.vendorExtensions().get("x-group-parameters").toString()); - Map objectMap = (Map) operation.get("operations"); - @SuppressWarnings("unchecked") - List operations = (List) objectMap.get("operation"); + OperationMap objectMap = operation.getOperations(); + List operations = objectMap.getOperation(); for (CodegenOperation op : operations) { if (isGroupParameters && !op.vendorExtensions.containsKey("x-group-parameters")) { op.vendorExtensions.put("x-group-parameters", Boolean.TRUE); @@ -617,7 +619,7 @@ void generateApis(List files, List allOperations, List a processMimeTypes(swagger.getProduces(), operation, "produces"); */ - allOperations.add(new HashMap<>(operation)); + allOperations.add(operation); addAuthenticationSwitches(operation); @@ -746,14 +748,13 @@ private void generateSupportingFiles(List files, Map bundl generateVersionMetadata(files); } - @SuppressWarnings("unchecked") - Map buildSupportFileBundle(List allOperations, List allModels) { + Map buildSupportFileBundle(List allOperations, List allModels) { Map bundle = new HashMap<>(config.additionalProperties()); bundle.put("apiPackage", config.apiPackage()); - Map apis = new HashMap<>(); - apis.put("apis", allOperations); + ApiInfoMap apis = new ApiInfoMap(); + apis.setApis(allOperations); URL url = URLPathUtils.getServerURL(openAPI, config.serverVariableOverrides()); @@ -887,7 +888,7 @@ public List generate() { List allModels = new ArrayList<>(); generateModels(files, allModels, filteredSchemas); // apis - List allOperations = new ArrayList<>(); + List allOperations = new ArrayList<>(); generateApis(files, allOperations, allModels); // supporting files @@ -1170,11 +1171,11 @@ private static String generateParameterId(Parameter parameter) { return parameter.getName() + ":" + parameter.getIn(); } - private Map processOperations(CodegenConfig config, String tag, List ops, List allModels) { - Map operations = new HashMap<>(); - Map objs = new HashMap<>(); - objs.put("classname", config.toApiName(tag)); - objs.put("pathPrefix", config.toApiVarName(tag)); + private OperationsMap processOperations(CodegenConfig config, String tag, List ops, List allModels) { + OperationsMap operations = new OperationsMap(); + OperationMap objs = new OperationMap(); + objs.setClassname(config.toApiName(tag)); + objs.setPathPrefix(config.toApiVarName(tag)); // check for operationId uniqueness Set opIds = new HashSet<>(); @@ -1187,9 +1188,9 @@ private Map processOperations(CodegenConfig config, String tag, } opIds.add(opId); } - objs.put("operation", ops); + objs.setOperation(ops); - operations.put("operations", objs); + operations.setOperation(objs); operations.put("package", config.apiPackage()); Set allImports = new ConcurrentSkipListSet<>(); @@ -1201,10 +1202,10 @@ private Map processOperations(CodegenConfig config, String tag, Set> imports = toImportsObjects(mappings); //Some codegen implementations rely on a list interface for the imports - operations.put("imports", imports.stream().collect(Collectors.toList())); + operations.setImports(new ArrayList<>(imports)); // add a flag to indicate whether there's any {{import}} - if (imports.size() > 0) { + if (!imports.isEmpty()) { operations.put("hasImport", true); } @@ -1239,18 +1240,14 @@ private Map getAllImportsMappings(Set allImports) { * @return The set of unique imports */ private Set> toImportsObjects(Map mappedImports) { - Set> result = new TreeSet>( - (Comparator>) (o1, o2) -> { - String s1 = o1.get("classname"); - String s2 = o2.get("classname"); - return s1.compareTo(s2); - } + Set> result = new TreeSet<>( + Comparator.comparing(o -> o.get("classname")) ); - mappedImports.entrySet().forEach(mapping -> { + mappedImports.forEach((key, value) -> { Map im = new LinkedHashMap<>(); - im.put("import", mapping.getKey()); - im.put("classname", mapping.getValue()); + im.put("import", key); + im.put("classname", value); result.add(im); }); return result; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java index 403c39edf221..4a1933e094ad 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java @@ -36,6 +36,8 @@ import org.openapitools.codegen.meta.features.WireFormatFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -607,9 +609,9 @@ private Map> getAuthScopes(List securi @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op1 : operationList) { if (op1.summary != null) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index f8abc0ab79f3..c0c24b50e4e7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -27,6 +27,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.templating.mustache.*; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; @@ -663,12 +665,12 @@ protected void updateNullableTypeProperty(Map models) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { super.postProcessOperationsWithModels(objs, allModels); if (objs != null) { - Map operations = (Map) objs.get("operations"); + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { // Check return types for collection diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java index 4cb893adc64c..f11566131068 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java @@ -12,6 +12,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -560,11 +562,11 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) objs.get("operations"); + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation op : ops) { if (op.hasConsumes) { if (!op.formParams.isEmpty() || op.isMultipart) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java index f4092be94410..7e3846981f28 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java @@ -26,6 +26,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -362,11 +364,9 @@ public String toOperationId(String operationId) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - @SuppressWarnings("unchecked") - Map objectMap = (Map) objs.get("operations"); - @SuppressWarnings("unchecked") - List operations = (List) objectMap.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap objectMap = objs.getOperations(); + List operations = objectMap.getOperation(); for (CodegenOperation operation : operations) { // http method verb conversion (e.g. PUT => Put) @@ -374,7 +374,7 @@ public Map postProcessOperationsWithModels(Map o } // remove model imports to avoid error - List> imports = (List>) objs.get("imports"); + List> imports = objs.getImports(); if (imports == null) return objs; @@ -401,7 +401,7 @@ public Map postProcessOperationsWithModels(Map o } // recursively add import for mapping one type to multiple imports - List> recursiveImports = (List>) objs.get("imports"); + List> recursiveImports = objs.getImports(); if (recursiveImports == null) return objs; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractFSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractFSharpCodegen.java index 64f5e400fc3d..b8a44efe9314 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractFSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractFSharpCodegen.java @@ -27,6 +27,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.templating.mustache.*; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; @@ -512,12 +514,12 @@ public void updateCodegenPropertyEnum(CodegenProperty var) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { super.postProcessOperationsWithModels(objs, allModels); if (objs != null) { - Map operations = (Map) objs.get("operations"); + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { // Check return types for collection diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java index 6c8fd53858c1..6dd27a80479d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java @@ -24,6 +24,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -462,11 +464,9 @@ public String toOperationId(String operationId) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - @SuppressWarnings("unchecked") - Map objectMap = (Map) objs.get("operations"); - @SuppressWarnings("unchecked") - List operations = (List) objectMap.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap objectMap = objs.getOperations(); + List operations = objectMap.getOperation(); for (CodegenOperation operation : operations) { // http method verb conversion (e.g. PUT => Put) @@ -474,7 +474,7 @@ public Map postProcessOperationsWithModels(Map o } // remove model imports to avoid error - List> imports = (List>) objs.get("imports"); + List> imports = objs.getImports(); if (imports == null) return objs; @@ -565,7 +565,7 @@ public Map postProcessOperationsWithModels(Map o } // recursively add import for mapping one type to multiple imports - List> recursiveImports = (List>) objs.get("imports"); + List> recursiveImports = objs.getImports(); if (recursiveImports == null) return objs; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGraphQLCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGraphQLCodegen.java index ecc1f0329509..1966b0548276 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGraphQLCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGraphQLCodegen.java @@ -21,6 +21,8 @@ import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -421,10 +423,10 @@ public String toModelImport(String name) { } @Override - public Map postProcessOperationsWithModels(Map operations, List allModels) { - Map objs = (Map) operations.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap operations, List allModels) { + OperationMap objs = operations.getOperations(); - for (CodegenOperation op : (List) objs.get("operation")) { + for (CodegenOperation op : objs.getOperation()) { // non GET/HEAD methods are mutation if (!"GET".equals(op.httpMethod.toUpperCase(Locale.ROOT)) && !"HEAD".equals(op.httpMethod.toUpperCase(Locale.ROOT))) { op.vendorExtensions.put("x-is-mutation", Boolean.TRUE); @@ -440,7 +442,7 @@ public Map postProcessOperationsWithModels(Map o } } - return objs; + return operations; } public String graphQlInputsPackage() { 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 fe7b41ed72ad..87cb92356d6a 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 @@ -38,6 +38,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1362,10 +1364,10 @@ public ModelsMap postProcessModels(ModelsMap objs) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { // Remove imports of List, ArrayList, Map and HashMap as they are // imported in the template already. - List> imports = (List>) objs.get("imports"); + List> imports = objs.getImports(); Pattern pattern = Pattern.compile("java\\.util\\.(List|ArrayList|Map|HashMap)"); for (Iterator> itr = imports.iterator(); itr.hasNext(); ) { String itrImport = itr.next().get("import"); @@ -1374,8 +1376,8 @@ public Map postProcessOperationsWithModels(Map o } } - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { Collection operationImports = new ConcurrentSkipListSet<>(); for (CodegenParameter p : op.allParams) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaJAXRSServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaJAXRSServerCodegen.java index 857092972ed3..965ef52af870 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaJAXRSServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaJAXRSServerCodegen.java @@ -25,6 +25,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.languages.features.BeanValidationFeatures; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.URLPathUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -168,12 +170,11 @@ public void preprocessOpenAPI(OpenAPI openAPI) { } @Override - @SuppressWarnings("unchecked") - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map updatedObjs = jaxrsPostProcessOperations(objs); - Map operations = (Map) updatedObjs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationsMap updatedObjs = jaxrsPostProcessOperations(objs); + OperationMap operations = updatedObjs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation co : ops) { handleImplicitHeaders(co); } @@ -181,13 +182,11 @@ public Map postProcessOperationsWithModels(Map o return updatedObjs; } - static Map jaxrsPostProcessOperations(Map objs) { - @SuppressWarnings("unchecked") - Map operations = (Map) objs.get("operations"); + static OperationsMap jaxrsPostProcessOperations(OperationsMap objs) { + OperationMap operations = objs.getOperations(); String commonPath = null; if (operations != null) { - @SuppressWarnings("unchecked") - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { if (operation.hasConsumes == Boolean.TRUE) { Map firstType = operation.consumes.get(0); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java index c157529aad88..985a74c08b00 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java @@ -24,6 +24,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -703,9 +705,9 @@ public ModelsMap postProcessModels(ModelsMap objs) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { // for API test method name // e.g. public function test{{vendorExtensions.x-testOperationId}}() 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 f2b588f8412b..77c3c6beade5 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 @@ -32,8 +32,11 @@ import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.DocumentationFeature; +import org.openapitools.codegen.model.ApiInfoMap; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -465,13 +468,11 @@ private void addSecurityExtensions(OpenAPI openAPI) { } } - @SuppressWarnings("unchecked") - private static List> getOperations(Map objs) { - List> result = new ArrayList>(); - Map apiInfo = (Map) objs.get("apiInfo"); - List> apis = (List>) apiInfo.get("apis"); - for (Map api : apis) { - result.add((Map) api.get("operations")); + private static List getOperations(Map objs) { + List result = new ArrayList<>(); + ApiInfoMap apiInfo = (ApiInfoMap) objs.get("apiInfo"); + for (OperationsMap api : apiInfo.getApis()) { + result.add(api.getOperations()); } return result; } @@ -483,9 +484,9 @@ private static List> sortOperationsByPath(List> opsByPathList = new ArrayList>(); + List> opsByPathList = new ArrayList<>(); for (Map.Entry> entry : opsByPath.asMap().entrySet()) { - Map opsByPathEntry = new HashMap(); + Map opsByPathEntry = new HashMap<>(); opsByPathList.add(opsByPathEntry); opsByPathEntry.put("path", entry.getKey()); opsByPathEntry.put("operation", entry.getValue()); @@ -570,9 +571,8 @@ public Map postProcessSupportingFileData(Map obj generateJSONSpecFile(objs); generateYAMLSpecFile(objs); - for (Map operations : getOperations(objs)) { - @SuppressWarnings("unchecked") - List ops = (List) operations.get("operation"); + for (OperationMap operations : getOperations(objs)) { + List ops = operations.getOperation(); List> opsByPathList = sortOperationsByPath(ops); operations.put("operationsByPath", opsByPathList); @@ -645,9 +645,9 @@ public void postProcessParameter(CodegenParameter parameter) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation operation : operationList) { Map skipTests = new HashMap<>(); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Apache2ConfigCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Apache2ConfigCodegen.java index 26fbb18827e3..bdfafa4dd552 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Apache2ConfigCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Apache2ConfigCodegen.java @@ -20,6 +20,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -88,18 +90,17 @@ public String escapeUnsafeCharacters(String input) { return input.replace("*/", "*_/").replace("/*", "/_*"); } - @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); - List newOpList = new ArrayList(); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); + List newOpList = new ArrayList<>(); for (CodegenOperation op : operationList) { String path = op.path; String[] items = path.split("/", -1); - List splitPath = new ArrayList(); + List splitPath = new ArrayList<>(); for (String item : items) { if (item.matches("^\\{(.*)\\}$")) { item = "*"; @@ -113,9 +114,10 @@ public Map postProcessOperationsWithModels(Map o if (!foundInNewList) { if (op1.path.equals(op.path)) { foundInNewList = true; + @SuppressWarnings("unchecked") List currentOtherMethodList = (List) op1.vendorExtensions.get("x-codegen-otherMethods"); if (currentOtherMethodList == null) { - currentOtherMethodList = new ArrayList(); + currentOtherMethodList = new ArrayList<>(); } op.operationIdCamelCase = op1.operationIdCamelCase; currentOtherMethodList.add(op); @@ -127,7 +129,7 @@ public Map postProcessOperationsWithModels(Map o newOpList.add(op); } } - operations.put("operation", newOpList); + operations.setOperation(newOpList); return objs; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java index a4b1927828d9..f72187c77cb1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java @@ -24,6 +24,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.URLPathUtils; import org.slf4j.Logger; @@ -462,13 +464,13 @@ protected void processOperation(CodegenOperation operation) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { super.postProcessOperationsWithModels(objs, allModels); // We need to postprocess the operations to add proper consumes tags and fix form file handling if (objs != null) { - Map operations = (Map) objs.get("operations"); + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { if (operation.consumes == null) { continue; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ClojureClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ClojureClientCodegen.java index 269a2b9df002..c5163ecb6e2f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ClojureClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ClojureClientCodegen.java @@ -27,6 +27,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -354,9 +356,9 @@ public String escapeText(String input) { } @Override - public Map postProcessOperationsWithModels(Map operations, List allModels) { - Map objs = (Map) operations.get("operations"); - List ops = (List) objs.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap operations, List allModels) { + OperationMap objs = operations.getOperations(); + List ops = objs.getOperation(); for (CodegenOperation op : ops) { // Convert httpMethod to lower case, e.g. "get", "post" op.httpMethod = op.httpMethod.toLowerCase(Locale.ROOT); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ConfluenceWikiCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ConfluenceWikiCodegen.java index 444617cc14f9..a8ea8c701e8a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ConfluenceWikiCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ConfluenceWikiCodegen.java @@ -23,6 +23,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.apache.commons.lang3.StringUtils; @@ -117,9 +119,9 @@ public String getTypeDeclaration(Schema p) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { op.httpMethod = op.httpMethod.toLowerCase(Locale.ROOT); } 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 df5c40d6dc91..8a49343ca12e 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 @@ -26,6 +26,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -255,14 +257,13 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation return op; } - @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - String classname = (String) operations.get("classname"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + String classname = operations.getClassname(); operations.put("classnameSnakeUpperCase", underscore(classname).toUpperCase(Locale.ROOT)); operations.put("classnameSnakeLowerCase", underscore(classname).toLowerCase(Locale.ROOT)); - List operationList = (List) operations.get("operation"); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { boolean consumeJson = false; boolean isParsingSupported = true; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQtAbstractCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQtAbstractCodegen.java index bf8161d5cfad..573242d54942 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQtAbstractCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQtAbstractCodegen.java @@ -7,6 +7,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -310,12 +312,11 @@ protected boolean needToImport(String type) { @Override - @SuppressWarnings("unchecked") - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map objectMap = (Map) objs.get("operations"); - List operations = (List) objectMap.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap objectMap = objs.getOperations(); + List operations = objectMap.getOperation(); - List> imports = (List>) objs.get("imports"); + List> imports = objs.getImports(); Map codegenModels = new HashMap<>(); for (ModelMap moObj : allModels) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java index 927ad85550be..8810aefabc23 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java @@ -29,6 +29,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import java.util.*; @@ -322,11 +324,10 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert } // override with any special post-processing - @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { for (String hdr : op.imports) { if (importMapping.containsKey(hdr)) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java index cc8e47b70d23..9d7ce46bafaa 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java @@ -24,6 +24,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import java.io.File; @@ -282,11 +284,10 @@ public String toApiFilename(String name) { return toApiName(name); } - @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); List newOpList = new ArrayList<>(); for (CodegenOperation op : operationList) { @@ -318,6 +319,7 @@ public Map postProcessOperationsWithModels(Map o if (op1.path.equals(op.path)) { foundInNewList = true; final String X_CODEGEN_OTHER_METHODS = "x-codegen-other-methods"; + @SuppressWarnings("unchecked") List currentOtherMethodList = (List) op1.vendorExtensions.get(X_CODEGEN_OTHER_METHODS); if (currentOtherMethodList == null) { currentOtherMethodList = new ArrayList<>(); @@ -332,7 +334,7 @@ public Map postProcessOperationsWithModels(Map o newOpList.add(op); } } - operations.put("operation", newOpList); + operations.setOperation(newOpList); return objs; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java index e7ffaf51aee5..998b875dd16d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java @@ -26,6 +26,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.templating.mustache.PrefixWithHashLambda; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; @@ -556,9 +558,9 @@ protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Sc } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) objs.get("operations"); + OperationMap operations = objs.getOperations(); HashMap modelMaps = new HashMap<>(); HashMap processedModelMaps = new HashMap<>(); @@ -567,7 +569,7 @@ public Map postProcessOperationsWithModels(Map o modelMaps.put(m.classname, m); } - List operationList = (List) operations.get("operation"); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { for (CodegenParameter p : op.allParams) { p.vendorExtensions.put("x-crystal-example", constructExampleCode(p, modelMaps, processedModelMaps)); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CsharpNetcoreFunctionsServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CsharpNetcoreFunctionsServerCodegen.java index e6390f6bcec3..966918caf6e6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CsharpNetcoreFunctionsServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CsharpNetcoreFunctionsServerCodegen.java @@ -23,6 +23,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.URLPathUtils; import org.slf4j.Logger; @@ -393,13 +395,13 @@ protected void processOperation(CodegenOperation operation) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { super.postProcessOperationsWithModels(objs, allModels); // We need to postprocess the operations to add proper consumes tags and fix form file handling if (objs != null) { - Map operations = (Map) objs.get("operations"); + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { if (operation.consumes == null) { continue; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java index 335f955b45fd..c2444fa93483 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java @@ -25,6 +25,8 @@ import org.openapitools.codegen.meta.features.ClientModificationFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ProcessUtils; import org.slf4j.Logger; @@ -264,10 +266,10 @@ private void appendCollection(StringBuilder sb, CodegenProperty property) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); Set> serializers = new HashSet<>(); Set resultImports = new HashSet<>(); @@ -303,6 +305,7 @@ public Map postProcessOperationsWithModels(Map o } } + // for some reason "import" structure is changed .. objs.put("imports", resultImports.stream().sorted().collect(Collectors.toList())); objs.put("serializers", serializers); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioNextClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioNextClientCodegen.java index 802df62a0ed8..0f2dac9c89f5 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioNextClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioNextClientCodegen.java @@ -26,6 +26,8 @@ import org.openapitools.codegen.meta.features.ClientModificationFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ProcessUtils; import org.slf4j.Logger; @@ -295,10 +297,10 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); Set resultImports = new HashSet<>(); @@ -365,6 +367,7 @@ public Map postProcessOperationsWithModels(Map o } } + // for some reason "import" structure is changed .. objs.put("imports", resultImports.stream().sorted().collect(Collectors.toList())); return objs; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java index 752bd29667e5..264e53e6748c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java @@ -22,6 +22,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import io.swagger.v3.oas.models.media.*; @@ -245,11 +247,11 @@ public ModelsMap postProcessModels(ModelsMap objs) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); Set modelImports = new HashSet<>(); Set fullImports = new HashSet<>(); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java index aca6fdb91633..5ae204450b36 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java @@ -28,6 +28,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -298,9 +300,9 @@ public void preprocessOpenAPI(OpenAPI openAPI) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) super.postProcessOperationsWithModels(objs, allModels).get("operations"); - List os = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = super.postProcessOperationsWithModels(objs, allModels).getOperations(); + List os = operations.getOperation(); List newOs = new ArrayList<>(); Pattern pattern = Pattern.compile("\\{([^\\}]+)\\}([^\\{]*)"); for (CodegenOperation o : os) { @@ -332,7 +334,7 @@ public Map postProcessOperationsWithModels(Map o newOs.add(eco); } - operations.put("operation", newOs); + operations.setOperation(newOs); return objs; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElmClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElmClientCodegen.java index 2d56f44c1c7b..16f1a974895b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElmClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElmClientCodegen.java @@ -28,6 +28,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -359,10 +361,10 @@ private static boolean anyOperationResponse(final List operati } @Override - @SuppressWarnings({"static-method", "unchecked"}) - public Map postProcessOperationsWithModels(Map operations, List allModels) { - Map objs = (Map) operations.get("operations"); - List ops = (List) objs.get("operation"); + @SuppressWarnings("static-method") + public OperationsMap postProcessOperationsWithModels(OperationsMap operations, List allModels) { + OperationMap objs = operations.getOperations(); + List ops = objs.getOperation(); ops.forEach(op -> { op.allParams = op.allParams.stream().sorted(new ParameterSorter()).collect(Collectors.toList()); op.responses.forEach(response -> { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java index 037f695b762f..fc6806f13169 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java @@ -23,6 +23,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.templating.mustache.JoinWithCommaLambda; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -309,10 +311,10 @@ public String toOperationId(String operationId) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List os = (List) operations.get("operation"); - List newOs = new ArrayList(); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List os = operations.getOperation(); + List newOs = new ArrayList<>(); Pattern pattern = Pattern.compile("\\{([^\\}]+)\\}"); for (CodegenOperation o : os) { // force http method to lower case @@ -322,7 +324,7 @@ public Map postProcessOperationsWithModels(Map o o.returnType = "[" + o.returnBaseType + "]"; } - ArrayList pathTemplateNames = new ArrayList(); + ArrayList pathTemplateNames = new ArrayList<>(); Matcher matcher = pattern.matcher(o.path); StringBuffer buffer = new StringBuffer(); while (matcher.find()) { @@ -341,7 +343,7 @@ public Map postProcessOperationsWithModels(Map o eco.setPathTemplateNames(pathTemplateNames); newOs.add(eco); } - operations.put("operation", newOs); + operations.setOperation(newOs); return objs; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangProperCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangProperCodegen.java index 67a8c5060828..0dc8fb5884f7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangProperCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangProperCodegen.java @@ -23,6 +23,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -368,9 +370,9 @@ public String toOperationId(String operationId) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List os = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List os = operations.getOperation(); List newOs = new ArrayList<>(); Pattern pattern = Pattern.compile("\\{([^\\}]+)\\}"); for (CodegenOperation o : os) { @@ -397,7 +399,7 @@ public Map postProcessOperationsWithModels(Map o } newOs.add(eco); } - operations.put("operation", newOs); + operations.setOperation(newOs); return objs; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangServerCodegen.java index 39ab803a6ffd..49f15cc26c38 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangServerCodegen.java @@ -20,6 +20,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -270,9 +272,9 @@ public String toApiFilename(String name) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { if (op.path != null) { op.path = op.path.replaceAll("\\{(.*?)\\}", ":$1"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java index 03768178951e..5558345785c7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java @@ -29,6 +29,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ProcessUtils; import org.slf4j.Logger; @@ -456,10 +458,10 @@ public ModelsMap postProcessModels(ModelsMap objs) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) objs.get("operations"); - HashMap modelMaps = new HashMap(); + OperationMap operations = objs.getOperations(); + HashMap modelMaps = new HashMap<>(); HashMap> processedModelMaps = new HashMap<>(); for (ModelMap modelMap : allModels) { @@ -467,7 +469,7 @@ public Map postProcessOperationsWithModels(Map o modelMaps.put(m.classname, m); } - List operationList = (List) operations.get("operation"); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { for (CodegenParameter p : op.allParams) { p.vendorExtensions.put("x-go-example", constructExampleCode(p, modelMaps, processedModelMaps)); @@ -670,4 +672,4 @@ private String constructExampleCode(CodegenModel codegenModel, HashMap postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { if (op.path != null) { op.path = op.path.replaceAll("\\{(.*?)\\}", ":$1"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoGinServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoGinServerCodegen.java index facd3e2bae16..ec3ca3ad75f1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoGinServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoGinServerCodegen.java @@ -23,6 +23,8 @@ import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -122,11 +124,11 @@ public GoGinServerCodegen() { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { if (op.path != null) { op.path = op.path.replaceAll("\\{(.*?)\\}", ":$1"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java index ca8c37767685..2a8acd9c23ca 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java @@ -22,6 +22,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -286,14 +288,12 @@ public void processOpts() { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); - @SuppressWarnings("unchecked") - Map objectMap = (Map) objs.get("operations"); - @SuppressWarnings("unchecked") - List operations = (List) objectMap.get("operation"); + OperationMap objectMap = objs.getOperations(); + List operations = objectMap.getOperation(); - List> imports = (List>) objs.get("imports"); + List> imports = objs.getImports(); if (imports == null) return objs; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GroovyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GroovyClientCodegen.java index 3728d8c1a203..5bbb1819a547 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GroovyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GroovyClientCodegen.java @@ -33,6 +33,8 @@ import org.openapitools.codegen.meta.features.SecurityFeature; import org.openapitools.codegen.meta.features.WireFormatFeature; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; public class GroovyClientCodegen extends AbstractJavaCodegen { @@ -126,9 +128,9 @@ public void processOpts() { } @Override - public Map postProcessOperationsWithModels(Map operations, List allModels) { - Map objs = (Map) operations.get("operations"); - List ops = (List) objs.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap operations, List allModels) { + OperationMap objs = operations.getOperations(); + List ops = objs.getOperation(); for (CodegenOperation op : ops) { // Overwrite path to map variable with path parameters op.path = op.path.replace("{", "${"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java index b54817cb2719..f728c766517f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java @@ -30,6 +30,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -809,10 +811,10 @@ public int compare(Map o1, Map o2) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map ret = super.postProcessOperationsWithModels(objs, allModels); - HashMap pathOps = (HashMap) ret.get("operations"); - ArrayList ops = (ArrayList) pathOps.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationsMap ret = super.postProcessOperationsWithModels(objs, allModels); + OperationMap pathOps = ret.getOperations(); + List ops = pathOps.getOperation(); if (ops.size() > 0) { ops.get(0).vendorExtensions.put(VENDOR_EXTENSION_X_HAS_NEW_TAG, true); } @@ -827,7 +829,7 @@ public Map postProcessOperationsWithModels(Map o m.vendorExtensions.put(VENDOR_EXTENSION_X_MIME_TYPES, mimeTypes); if ((boolean) additionalProperties.get(PROP_GENERATE_FORM_URLENCODED_INSTANCES) && mimeTypes.contains("MimeFormUrlEncoded")) { - Boolean hasMimeFormUrlEncoded = true; + boolean hasMimeFormUrlEncoded = true; for (CodegenProperty v : m.vars) { if (!(v.isPrimitiveType || v.isString || v.isDate || v.isDateTime)) { hasMimeFormUrlEncoded = false; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFClientCodegen.java index d478d4e2daba..a45e743b8f98 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFClientCodegen.java @@ -24,6 +24,7 @@ import org.openapitools.codegen.languages.features.LoggingTestFeatures; import org.openapitools.codegen.languages.features.UseGenericResponseFeatures; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationsMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -166,7 +167,7 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); return AbstractJavaJAXRSServerCodegen.jaxrsPostProcessOperations(objs); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFExtServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFExtServerCodegen.java index ba2362e0230d..54e4445cfd3d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFExtServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFExtServerCodegen.java @@ -38,6 +38,8 @@ import org.openapitools.codegen.languages.features.CXFExtServerFeatures; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.JsonCache; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.JsonCache.CacheException; @@ -1161,17 +1163,17 @@ private void postProcessModel(CodegenModel cm) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map result = super.postProcessOperationsWithModels(objs, allModels); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationsMap result = super.postProcessOperationsWithModels(objs, allModels); if (generateOperationBody) { // We generate the operation body in code because the logic to do so is far too complicated to be expressed // in the logic-less Mustache templating system. @SuppressWarnings("unchecked") - Map operations = (Map) result.get("operations"); + OperationMap operations = result.getOperations(); if (operations != null) { - String classname = (String) operations.get("classname"); + String classname = operations.getClassname(); // Map the models so we can look them up by name. Map models = new HashMap<>(); @@ -1181,8 +1183,7 @@ public Map postProcessOperationsWithModels(Map o } StringBuilder buffer = new StringBuilder(); - @SuppressWarnings("unchecked") - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation op : ops) { applyDefaultContentTypes(op); String testDataPath = '/' + classname + '/' + op.operationId; @@ -1246,16 +1247,16 @@ else if (!hasCacheMethod(var)) // did not include the ones we've just added to support the code in the operation bodies. Therefore it // is necessary to recompute the imports and overwrite the existing ones. The code below was copied from // the private DefaultGenerator.processOperations() method to achieve this end. - Set allImports = new TreeSet(); + Set allImports = new TreeSet<>(); for (CodegenOperation op : ops) { allImports.addAll(op.imports); } allImports.add("List"); allImports.add("Map"); - List> imports = new ArrayList>(); + List> imports = new ArrayList<>(); for (String nextImport : allImports) { - Map im = new LinkedHashMap(); + Map im = new LinkedHashMap<>(); String mapping = importMapping().get(nextImport); if (mapping == null) { mapping = toModelImport(nextImport); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 047af4467179..6b52ed17027a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -29,6 +29,8 @@ import org.openapitools.codegen.meta.features.GlobalFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.templating.mustache.CaseFormatLambda; import org.openapitools.codegen.utils.ProcessUtils; import org.slf4j.Logger; @@ -76,6 +78,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String GOOGLE_API_CLIENT = "google-api-client"; public static final String JERSEY1 = "jersey1"; public static final String JERSEY2 = "jersey2"; + public static final String JERSEY3 = "jersey3"; public static final String NATIVE = "native"; public static final String OKHTTP_GSON = "okhttp-gson"; public static final String RESTEASY = "resteasy"; @@ -162,10 +165,11 @@ public JavaClientCodegen() { cliOptions.add(CliOption.newString(GRADLE_PROPERTIES, "Append additional Gradle properties to the gradle.properties file")); cliOptions.add(CliOption.newString(ERROR_OBJECT_TYPE, "Error Object type. (This option is for okhttp-gson-next-gen only)")); cliOptions.add(CliOption.newString(CONFIG_KEY, "Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.")); - cliOptions.add(CliOption.newBoolean(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC + " Only jersey2, native, okhttp-gson support this option.")); + cliOptions.add(CliOption.newBoolean(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC + " Only jersey2, jersey3, native, okhttp-gson support this option.")); - supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libraries instead."); + supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey3' or other HTTP libraries instead."); supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x"); + supportedLibraries.put(JERSEY3, "HTTP client: Jersey client 3.x. JSON processing: Jackson 2.x"); supportedLibraries.put(FEIGN, "HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x."); supportedLibraries.put(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'."); supportedLibraries.put(RETROFIT_2, "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)"); @@ -369,7 +373,7 @@ public void processOpts() { } // helper for client library that allow to parse/format java.time.OffsetDateTime or org.threeten.bp.OffsetDateTime - if (additionalProperties.containsKey("jsr310") && (isLibrary(WEBCLIENT) || isLibrary(VERTX) || isLibrary(RESTTEMPLATE) || isLibrary(RESTEASY) || isLibrary(MICROPROFILE) || isLibrary(JERSEY1) || isLibrary(JERSEY2) || isLibrary(APACHE))) { + if (additionalProperties.containsKey("jsr310") && (isLibrary(WEBCLIENT) || isLibrary(VERTX) || isLibrary(RESTTEMPLATE) || isLibrary(RESTEASY) || isLibrary(MICROPROFILE) || isLibrary(JERSEY1) || isLibrary(JERSEY2) || isLibrary(JERSEY3) || isLibrary(APACHE))) { supportingFiles.add(new SupportingFile("JavaTimeFormatter.mustache", invokerFolder, "JavaTimeFormatter.java")); } @@ -478,6 +482,23 @@ public void processOpts() { // one by one for each library. supportsAdditionalPropertiesWithComposedSchema = true; + } else if (JERSEY3.equals(getLibrary())) { + additionalProperties.put("jersey3", true); + supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java")); + supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java")); + if (ProcessUtils.hasHttpSignatureMethods(openAPI)) { + supportingFiles.add(new SupportingFile("auth/HttpSignatureAuth.mustache", authFolder, "HttpSignatureAuth.java")); + } + supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", modelsFolder, "AbstractOpenApiSchema.java")); + forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON); + + // Composed schemas can have the 'additionalProperties' keyword, as specified in JSON schema. + // In principle, this should be enabled by default for all code generators. However due to limitations + // in other code generators, support needs to be enabled on a case-by-case basis. + // The flag below should be set for all Java libraries, but the templates need to be ported + // one by one for each library. + supportsAdditionalPropertiesWithComposedSchema = true; + } else if (NATIVE.equals(getLibrary())) { supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java")); supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java")); @@ -616,14 +637,13 @@ public void processOpts() { } } - @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { super.postProcessOperationsWithModels(objs, allModels); if (RETROFIT_2.equals(getLibrary())) { - Map operations = (Map) objs.get("operations"); + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { if (operation.hasConsumes == Boolean.TRUE) { @@ -661,8 +681,8 @@ public int compare(CodegenParameter one, CodegenParameter another) { // camelize path variables for Feign client if (FEIGN.equals(getLibrary())) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); Pattern methodPattern = Pattern.compile("^(.*):([^:]*)$"); for (CodegenOperation op : operationList) { String path = op.path; @@ -892,7 +912,7 @@ public ModelsMap postProcessModels(ModelsMap objs) { CodegenModel cm = mo.getModel(); cm.getVendorExtensions().putIfAbsent("x-implements", new ArrayList()); - if (JERSEY2.equals(getLibrary()) || NATIVE.equals(getLibrary()) || OKHTTP_GSON.equals(getLibrary())) { + if (JERSEY2.equals(getLibrary()) || JERSEY3.equals(getLibrary()) || NATIVE.equals(getLibrary()) || OKHTTP_GSON.equals(getLibrary())) { cm.getVendorExtensions().put("x-implements", new ArrayList()); if (cm.oneOf != null && !cm.oneOf.isEmpty() && cm.oneOf.contains("ModelNull")) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java index 0d3c52998ba5..471fb2a14cca 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java @@ -25,6 +25,8 @@ import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -130,7 +132,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera } List opList = operations.get(basePath); if (opList == null) { - opList = new ArrayList(); + opList = new ArrayList<>(); operations.put(basePath, opList); } opList.add(co); @@ -138,10 +140,10 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { if (operation.returnType == null) { operation.returnType = "Void"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautAbstractCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautAbstractCodegen.java index ba77a54ca07c..f58e79c22666 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautAbstractCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautAbstractCodegen.java @@ -7,6 +7,8 @@ import org.openapitools.codegen.meta.features.SecurityFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import java.util.*; import java.util.stream.Collectors; @@ -318,14 +320,14 @@ public boolean isUseBeanValidation() { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); Map models = allModels.stream() .map(ModelMap::getModel) .collect(Collectors.toMap(v -> v.classname, v -> v)); - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { // Set whether body is supported in request diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautServerCodegen.java index 49cbf071d263..95764efd2cd0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautServerCodegen.java @@ -4,6 +4,8 @@ import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -185,12 +187,12 @@ public void setParameterExampleValue(CodegenParameter p) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); // Add the controller classname to operations - Map operations = (Map) objs.get("operations"); - String controllerClassname = StringUtils.camelize(controllerPrefix + "_" + operations.get("pathPrefix") + "_" + controllerSuffix); + OperationMap operations = objs.getOperations(); + String controllerClassname = StringUtils.camelize(controllerPrefix + "_" + operations.getPathPrefix() + "_" + controllerSuffix); objs.put("controllerClassname", controllerClassname); List allOperations = (List) operations.get("operation"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPKMSTServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPKMSTServerCodegen.java index f951e0e5b345..22bd809dde61 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPKMSTServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPKMSTServerCodegen.java @@ -25,6 +25,8 @@ import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.URLPathUtils; import java.io.File; @@ -311,12 +313,11 @@ public void processOpts() { serviceName + "IT.java")); } - @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (final CodegenOperation operation : ops) { List responses = operation.responses; if (responses != null) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java index 00daf661d007..9de29a5ef90c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java @@ -23,6 +23,8 @@ import org.openapitools.codegen.languages.features.BeanValidationFeatures; import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -305,11 +307,11 @@ public void setSupportAsync(boolean supportAsync) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { for (CodegenParameter param : operation.allParams) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java index e73e6ea2d835..58f6f3626553 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java @@ -23,6 +23,8 @@ import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -120,10 +122,10 @@ public void processOpts() { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { if (operation.returnType == null) { operation.returnType = "Void"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java index 6943342279a1..ddff4cf71089 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java @@ -28,6 +28,8 @@ import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.URLPathUtils; import org.slf4j.Logger; @@ -191,11 +193,11 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map newObjs = super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) newObjs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationsMap newObjs = super.postProcessOperationsWithModels(objs, allModels); + OperationMap operations = newObjs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { operation.httpMethod = operation.httpMethod.toLowerCase(Locale.ROOT); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXWebServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXWebServerCodegen.java index dafa810b3229..a7fc895b2153 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXWebServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXWebServerCodegen.java @@ -21,6 +21,8 @@ import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import java.io.File; import java.util.*; @@ -126,13 +128,12 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert } } - @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map newObjs = super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) newObjs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationsMap newObjs = super.postProcessOperationsWithModels(objs, allModels); + OperationMap operations = newObjs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { operation.httpMethod = operation.httpMethod.toLowerCase(Locale.ROOT); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptApolloClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptApolloClientCodegen.java index de7511ebe719..d27716dffdbb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptApolloClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptApolloClientCodegen.java @@ -29,6 +29,8 @@ import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -908,13 +910,13 @@ private boolean isPrimitiveType(String type) { @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { // Generate and store argument list string of each operation into // vendor-extension: x-codegen-argList. - Map operations = (Map) objs.get("operations"); + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { List argList = new ArrayList<>(); boolean hasOptionalParams = false; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java index 5e8b04c7e550..f6398e2f114b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java @@ -28,6 +28,8 @@ import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -969,15 +971,14 @@ private boolean isPrimitiveType(String type) { return Arrays.asList(primitives).contains(type); } - @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { // Generate and store argument list string of each operation into // vendor-extension: x-codegen-argList. - Map operations = (Map) objs.get("operations"); + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { List argList = new ArrayList<>(); boolean hasOptionalParams = false; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClosureAngularClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClosureAngularClientCodegen.java index b175596f2498..f93d32affc20 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClosureAngularClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClosureAngularClientCodegen.java @@ -24,6 +24,7 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -272,16 +273,10 @@ public ModelsMap postProcessModels(ModelsMap objs) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - if (objs.get("imports") instanceof List) { - List> imports = (ArrayList>)objs.get("imports"); - Collections.sort(imports, new Comparator>() { - public int compare(Map o1, Map o2) { - return o1.get("import").compareTo(o2.get("import")); - } - }); - objs.put("imports", imports); - } + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + List> imports = objs.getImports(); + imports.sort(Comparator.comparing(o -> o.get("import"))); + objs.put("imports", imports); return objs; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java index ce65a6bcd85f..dead7b17ff56 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java @@ -35,6 +35,8 @@ import org.openapitools.codegen.meta.features.WireFormatFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ProcessUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -767,12 +769,11 @@ private boolean usesRetrofit2Library() { } @Override - @SuppressWarnings("unchecked") - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) objs.get("operations"); + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { if (JVM_RETROFIT2.equals(getLibrary()) && StringUtils.isNotEmpty(operation.path) && operation.path.startsWith("/")) { @@ -789,22 +790,22 @@ public Map postProcessOperationsWithModels(Map o // match on first part in mediaTypes like 'application/json; charset=utf-8' int endIndex = mediaTypeValue.indexOf(';'); String mediaType = (endIndex == -1 - ? mediaTypeValue - : mediaTypeValue.substring(0, endIndex) + ? mediaTypeValue + : mediaTypeValue.substring(0, endIndex) ).trim(); return "multipart/form-data".equals(mediaType) - || "application/x-www-form-urlencoded".equals(mediaType) - || (mediaType.startsWith("application/") && mediaType.endsWith("json")); + || "application/x-www-form-urlencoded".equals(mediaType) + || (mediaType.startsWith("application/") && mediaType.endsWith("json")); }; operation.consumes = operation.consumes == null ? null : operation.consumes.stream() - .filter(isSerializable) - .limit(1) - .collect(Collectors.toList()); + .filter(isSerializable) + .limit(1) + .collect(Collectors.toList()); operation.hasConsumes = operation.consumes != null && !operation.consumes.isEmpty(); operation.produces = operation.produces == null ? null : operation.produces.stream() - .filter(isSerializable) - .collect(Collectors.toList()); + .filter(isSerializable) + .collect(Collectors.toList()); operation.hasProduces = operation.produces != null && !operation.produces.isEmpty(); } @@ -850,7 +851,7 @@ public Map postProcessOperationsWithModels(Map o } } } - return operations; + return objs; } private static boolean isMultipartType(List> consumes) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java index 61b4f39c9c01..8cfdc2026381 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -26,6 +26,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.URLPathUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -578,10 +580,10 @@ public ModelsMap postProcessModelsEnum(ModelsMap objs) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); ops.forEach(operation -> { List responses = operation.responses; if (responses != null) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/LuaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/LuaClientCodegen.java index 4508ca631eea..aeff481eaf6e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/LuaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/LuaClientCodegen.java @@ -26,6 +26,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -420,11 +422,9 @@ public String toOperationId(String operationId) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - @SuppressWarnings("unchecked") - Map objectMap = (Map) objs.get("operations"); - @SuppressWarnings("unchecked") - List operations = (List) objectMap.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap objectMap = objs.getOperations(); + List operations = objectMap.getOperation(); for (CodegenOperation op : operations) { String[] items = op.path.split("/", -1); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NimClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NimClientCodegen.java index 7d8e79e2d8c4..c524436a0519 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NimClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NimClientCodegen.java @@ -25,6 +25,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.StringUtils; import org.slf4j.Logger; @@ -258,11 +260,9 @@ public String toOperationId(String operationId) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - @SuppressWarnings("unchecked") - Map objectMap = (Map) objs.get("operations"); - @SuppressWarnings("unchecked") - List operations = (List) objectMap.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap objectMap = objs.getOperations(); + List operations = objectMap.getOperation(); for (CodegenOperation operation : operations) { operation.httpMethod = operation.httpMethod.toLowerCase(Locale.ROOT); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NodeJSExpressServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NodeJSExpressServerCodegen.java index 0fadd7cc7b0c..0f01e91e89dc 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NodeJSExpressServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NodeJSExpressServerCodegen.java @@ -31,7 +31,10 @@ import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.meta.features.*; +import org.openapitools.codegen.model.ApiInfoMap; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.URLPathUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -238,11 +241,9 @@ public void setExportedName(String name) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - @SuppressWarnings("unchecked") - Map objectMap = (Map) objs.get("operations"); - @SuppressWarnings("unchecked") - List operations = (List) objectMap.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap objectMap = objs.getOperations(); + List operations = objectMap.getOperation(); for (CodegenOperation operation : operations) { operation.httpMethod = operation.httpMethod.toLowerCase(Locale.ROOT); @@ -272,13 +273,11 @@ public Map postProcessOperationsWithModels(Map o return objs; } - @SuppressWarnings("unchecked") - private static List> getOperations(Map objs) { - List> result = new ArrayList<>(); - Map apiInfo = (Map) objs.get("apiInfo"); - List> apis = (List>) apiInfo.get("apis"); - for (Map api : apis) { - result.add((Map) api.get("operations")); + private static List getOperations(Map objs) { + List result = new ArrayList<>(); + ApiInfoMap apiInfo = (ApiInfoMap) objs.get("apiInfo"); + for (OperationsMap api : apiInfo.getApis()) { + result.add(api.getOperations()); } return result; } @@ -401,9 +400,8 @@ public void preprocessOpenAPI(OpenAPI openAPI) { public Map postProcessSupportingFileData(Map objs) { generateYAMLSpecFile(objs); - for (Map operations : getOperations(objs)) { - @SuppressWarnings("unchecked") - List ops = (List) operations.get("operation"); + for (OperationMap operations : getOperations(objs)) { + List ops = operations.getOperation(); List> opsByPathList = sortOperationsByPath(ops); operations.put("operationsByPath", opsByPathList); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java index c780c26f0747..509f6d499562 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java @@ -27,6 +27,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -713,11 +715,9 @@ private ModelMap buildEnumModelWrapper(String enumName, String values) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - @SuppressWarnings("unchecked") - Map objectMap = (Map) objs.get("operations"); - @SuppressWarnings("unchecked") - List operations = (List) objectMap.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap objectMap = objs.getOperations(); + List operations = objectMap.getOperation(); for (CodegenOperation operation : operations) { // http method verb conversion, depending on client library (e.g. Hyper: PUT => Put, Reqwest: PUT => put) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ObjcClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ObjcClientCodegen.java index 4c0c0b9a2d73..5a2a38224778 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ObjcClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ObjcClientCodegen.java @@ -23,6 +23,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -652,11 +654,11 @@ public void setLicense(String license) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { if (!operation.allParams.isEmpty()) { String firstParamName = operation.allParams.get(0).paramName; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLaravelServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLaravelServerCodegen.java index 06277a748ccd..c2b27f479773 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLaravelServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLaravelServerCodegen.java @@ -22,6 +22,8 @@ import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import java.io.File; import java.util.*; @@ -234,11 +236,9 @@ public void processOpts() { // override with any special post-processing @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - @SuppressWarnings("unchecked") - Map objectMap = (Map) objs.get("operations"); - @SuppressWarnings("unchecked") - List operations = (List) objectMap.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap objectMap = objs.getOperations(); + List operations = objectMap.getOperation(); for (CodegenOperation op : operations) { op.httpMethod = op.httpMethod.toLowerCase(Locale.ROOT); @@ -261,12 +261,7 @@ public Map postProcessOperationsWithModels(Map o // sort the endpoints in ascending to avoid the route priority issue. // https://github.com/swagger-api/swagger-codegen/issues/2643 - Collections.sort(operations, new Comparator() { - @Override - public int compare(CodegenOperation lhs, CodegenOperation rhs) { - return lhs.path.compareTo(rhs.path); - } - }); + operations.sort(Comparator.comparing(lhs -> lhs.path)); return objs; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLumenServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLumenServerCodegen.java index 2c0c16a07bcc..fc5b114d3f47 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLumenServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLumenServerCodegen.java @@ -22,6 +22,8 @@ import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import java.io.File; import java.util.*; @@ -166,23 +168,16 @@ public void processOpts() { // override with any special post-processing @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - @SuppressWarnings("unchecked") - Map objectMap = (Map) objs.get("operations"); - @SuppressWarnings("unchecked") - List operations = (List) objectMap.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap objectMap = objs.getOperations(); + List operations = objectMap.getOperation(); for (CodegenOperation op : operations) { op.httpMethod = op.httpMethod.toLowerCase(Locale.ROOT); } // sort the endpoints in ascending to avoid the route priority issue. - Collections.sort(operations, new Comparator() { - @Override - public int compare(CodegenOperation lhs, CodegenOperation rhs) { - return lhs.path.compareTo(rhs.path); - } - }); + operations.sort(Comparator.comparing(lhs -> lhs.path)); escapeMediaType(operations); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpMezzioPathHandlerServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpMezzioPathHandlerServerCodegen.java index c3d575dbda59..cd81b3174a60 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpMezzioPathHandlerServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpMezzioPathHandlerServerCodegen.java @@ -31,6 +31,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -416,10 +418,10 @@ protected void generateContainerSchemas(OpenAPI openAPI, Schema schema) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); String httpMethodDeclaration; String pathPattern = null; for (CodegenOperation op : operationList) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSilexServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSilexServerCodegen.java index 38b301054953..fd7106883263 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSilexServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSilexServerCodegen.java @@ -23,6 +23,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; @@ -260,9 +262,9 @@ public String escapeUnsafeCharacters(String input) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { String path = op.path; String[] items = path.split("/", -1); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlim4ServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlim4ServerCodegen.java index c3e79f35e189..9e829dc45389 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlim4ServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlim4ServerCodegen.java @@ -30,7 +30,10 @@ import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.meta.features.*; +import org.openapitools.codegen.model.ApiInfoMap; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -254,9 +257,9 @@ public void processOpts() { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); addUserClassnameToOperations(operations); escapeMediaType(operationList); return objs; @@ -264,21 +267,16 @@ public Map postProcessOperationsWithModels(Map o @Override public Map postProcessSupportingFileData(Map objs) { - Map apiInfo = (Map) objs.get("apiInfo"); - List> apiList = (List>) apiInfo.get("apis"); - for (HashMap api : apiList) { - HashMap operations = (HashMap) api.get("operations"); - List operationList = (List) operations.get("operation"); + ApiInfoMap apiInfo = (ApiInfoMap) objs.get("apiInfo"); + for (OperationsMap api : apiInfo.getApis()) { + List operationList = api.getOperations().getOperation(); // Sort operations to avoid static routes shadowing // ref: https://github.com/nikic/FastRoute/blob/master/src/DataGenerator/RegexBasedAbstract.php#L92-L101 - Collections.sort(operationList, new Comparator() { - @Override - public int compare(CodegenOperation one, CodegenOperation another) { + operationList.sort((one, another) -> { if (one.getHasPathParams() && !another.getHasPathParams()) return 1; if (!one.getHasPathParams() && another.getHasPathParams()) return -1; return 0; - } }); } @@ -310,8 +308,8 @@ public String toApiTestFilename(String name) { * * @param operations codegen object with operations */ - private void addUserClassnameToOperations(Map operations) { - String classname = (String) operations.get("classname"); + private void addUserClassnameToOperations(OperationMap operations) { + String classname = operations.getClassname(); classname = classname.replaceAll("^" + abstractNamePrefix, ""); classname = classname.replaceAll(abstractNameSuffix + "$", ""); operations.put(USER_CLASSNAME_KEY, classname); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlimServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlimServerCodegen.java index 211de3349be2..eacf50eb9b12 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlimServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlimServerCodegen.java @@ -26,7 +26,10 @@ import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.meta.features.*; +import org.openapitools.codegen.model.ApiInfoMap; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -157,9 +160,9 @@ public void processOpts() { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); addUserClassnameToOperations(operations); escapeMediaType(operationList); return objs; @@ -167,21 +170,16 @@ public Map postProcessOperationsWithModels(Map o @Override public Map postProcessSupportingFileData(Map objs) { - Map apiInfo = (Map) objs.get("apiInfo"); - List> apiList = (List>) apiInfo.get("apis"); - for (HashMap api : apiList) { - HashMap operations = (HashMap) api.get("operations"); - List operationList = (List) operations.get("operation"); + ApiInfoMap apiInfo = (ApiInfoMap) objs.get("apiInfo"); + for (OperationsMap api : apiInfo.getApis()) { + List operationList = api.getOperations().getOperation(); // Sort operations to avoid static routes shadowing // ref: https://github.com/nikic/FastRoute/blob/master/src/DataGenerator/RegexBasedAbstract.php#L92-L101 - Collections.sort(operationList, new Comparator() { - @Override - public int compare(CodegenOperation one, CodegenOperation another) { + operationList.sort((one, another) -> { if (one.getHasPathParams() && !another.getHasPathParams()) return 1; if (!one.getHasPathParams() && another.getHasPathParams()) return -1; return 0; - } }); } return objs; @@ -217,8 +215,8 @@ public String toApiTestFilename(String name) { * * @param operations codegen object with operations */ - private void addUserClassnameToOperations(Map operations) { - String classname = (String) operations.get("classname"); + private void addUserClassnameToOperations(OperationMap operations) { + String classname = operations.getClassname(); classname = classname.replaceAll("^" + abstractNamePrefix, ""); classname = classname.replaceAll(abstractNameSuffix + "$", ""); operations.put(USER_CLASSNAME_KEY, classname); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java index 90c362163318..36048286d03c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java @@ -24,6 +24,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -391,15 +393,15 @@ public void processOpts() { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) objs.get("operations"); - operations.put("controllerName", toControllerName((String) operations.get("pathPrefix"))); - operations.put("symfonyService", toSymfonyService((String) operations.get("pathPrefix"))); + OperationMap operations = objs.getOperations(); + operations.put("controllerName", toControllerName(operations.getPathPrefix())); + operations.put("symfonyService", toSymfonyService(operations.getPathPrefix())); List authMethods = new ArrayList<>(); - List operationList = (List) operations.get("operation"); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { // Loop through all input parameters to determine, whether we have to import something to diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java index ceabdd28d40a..89227f989bc1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java @@ -27,6 +27,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ProcessUtils; import org.slf4j.Logger; @@ -1012,8 +1014,8 @@ public String toParamName(String name) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); HashMap modelMaps = new HashMap<>(); HashMap processedModelMaps = new HashMap<>(); @@ -1022,7 +1024,7 @@ public Map postProcessOperationsWithModels(Map o modelMaps.put(m.classname, m); } - List operationList = (List) operations.get("operation"); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { int index = 0; for (CodegenParameter p : op.allParams) { @@ -1123,7 +1125,8 @@ public ModelsMap postProcessModels(ModelsMap objs) { } } - return objs; + // process enum in models + return postProcessModelsEnum(objs); } @Override @@ -1543,4 +1546,30 @@ public void postProcess() { @Override public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.POWERSHELL; } + + @Override + public String toEnumVarName(String name, String datatype) { + if (name.length() == 0) { + return "EMPTY"; + } + + // for symbol, e.g. $, # + if (getSymbolName(name) != null) { + return (getSymbolName(name)).toUpperCase(Locale.ROOT); + } + + // number + if ("Int16".equals(datatype) || "Int32".equals(datatype) || "Int64".equals(datatype) || + "UInt16".equals(datatype) || "UInt32".equals(datatype) || "UInt64".equals(datatype) || + "Double".equals(datatype) || "Single".equals(datatype) || "Decimal".equals(datatype)) { + String varName = name; + varName = varName.replaceAll("-", "MINUS_"); + varName = varName.replaceAll("\\+", "PLUS_"); + varName = varName.replaceAll("\\.", "_DOT_"); + return varName; + } + + // remove special character + return sanitizeName(name); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java index 7b2a83175dbb..b0d1419275ae 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java @@ -28,6 +28,8 @@ import org.openapitools.codegen.meta.features.WireFormatFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.apache.commons.lang3.StringUtils; @@ -541,9 +543,9 @@ public String getSchemaType(Schema p) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { int index = 1; for (CodegenParameter p : op.allParams) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index 80ebe46c2722..942358eac042 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -31,6 +31,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ProcessUtils; import org.openapitools.codegen.meta.GeneratorMetadata; @@ -365,13 +367,13 @@ public String toModelImport(String name) { @Override @SuppressWarnings("static-method") - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { // fix the imports that each model has, add the module reference to the model // loops through imports and converts them all // from 'Pet' to 'from petstore_api.model.pet import Pet' - HashMap val = (HashMap) objs.get("operations"); - ArrayList operations = (ArrayList) val.get("operation"); + OperationMap val = objs.getOperations(); + List operations = val.getOperation(); for (CodegenOperation operation : operations) { if (operation.imports.isEmpty()) { continue; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonExperimentalClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonExperimentalClientCodegen.java index 44130d9b6e21..962495fedb0a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonExperimentalClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonExperimentalClientCodegen.java @@ -17,6 +17,8 @@ package org.openapitools.codegen.languages; import com.github.curiousoddman.rgxgen.RgxGen; +import com.github.curiousoddman.rgxgen.config.RgxGenOption; +import com.github.curiousoddman.rgxgen.config.RgxGenProperties; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.servers.Server; @@ -26,6 +28,8 @@ import org.openapitools.codegen.ignore.CodegenIgnoreProcessor; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.templating.*; import io.swagger.v3.core.util.Json; import io.swagger.v3.oas.models.media.*; @@ -424,12 +428,13 @@ protected File processTemplateToFile(Map templateData, String te It is very verbose to write all of this info into the api template This ingests all operations under a tag in the objs input and writes out one file for each endpoint */ - protected void generateEndpoints(Map objs) { + protected void generateEndpoints(OperationsMap objs) { if (!(Boolean) additionalProperties.get(CodegenConstants.GENERATE_APIS)) { return; } - HashMap operations = (HashMap) objs.get("operations"); - ArrayList codegenOperations = (ArrayList) operations.get("operation"); + OperationMap operations = objs.getOperations(); + List codegenOperations = operations.getOperation(); + Set tagsNeedingInitFiles = new HashSet<>(); for (CodegenOperation co: codegenOperations) { for (Tag tag: co.tags) { String tagName = tag.getName(); @@ -441,13 +446,28 @@ protected void generateEndpoints(Map objs) { String templateName = "endpoint.handlebars"; String filename = endpointFilename(templateName, pythonTagName, co.operationId); + tagsNeedingInitFiles.add(pythonTagName); try { - File written = processTemplateToFile(operationMap, templateName, filename, true, CodegenConstants.APIS); + processTemplateToFile(operationMap, templateName, filename, true, CodegenConstants.APIS); } catch (IOException e) { LOGGER.error("Error when writing template file {}", e.toString()); } } } + String templateName = "__init__api_endpoints.handlebars"; + for (String tagNeedingInitFiles: tagsNeedingInitFiles) { + try { + Map operationMap = new HashMap<>(); + String apiModuleName = toApiFilename(tagNeedingInitFiles); + operationMap.put("packageName", packageName); + operationMap.put("apiModuleName", apiModuleName); + operationMap.put("classname", toApiName(tagNeedingInitFiles)); + String filename = endpointFilename(templateName, tagNeedingInitFiles, "__init__"); + processTemplateToFile(operationMap, templateName, filename, true, CodegenConstants.APIS); + } catch (IOException e) { + LOGGER.error("Error when writing endpoint __init__ file {}", e.toString()); + } + } } /* @@ -609,7 +629,7 @@ public String pythonDate(Object dateValue) { } else { strValue = dateValue.toString(); } - return "isoparse('" + strValue + "').date()"; + return strValue; } public String pythonDateTime(Object dateTimeValue) { @@ -626,7 +646,7 @@ public String pythonDateTime(Object dateTimeValue) { } else { strValue = dateTimeValue.toString(); } - return "isoparse('" + strValue + "')"; + return strValue; } /** @@ -671,14 +691,14 @@ public String toModelImport(String name) { @Override @SuppressWarnings("static-method") - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { // fix the imports that each model has, add the module reference to the model // loops through imports and converts them all // from 'Pet' to 'from petstore_api.model.pet import Pet' - HashMap val = (HashMap) objs.get("operations"); - ArrayList operations = (ArrayList) val.get("operation"); - ArrayList> imports = (ArrayList>) objs.get("imports"); + OperationMap val = objs.getOperations(); + List operations = val.getOperation(); + List> imports = objs.getImports(); for (CodegenOperation operation : operations) { if (operation.imports.size() == 0) { continue; @@ -1353,6 +1373,13 @@ private String ensureQuotes(String in) { return "\"" + in + "\""; } + @Override + public String toExampleValue(Schema schema) { + String modelName = getModelName(schema); + Object objExample = getObjectExample(schema); + return toExampleValueRecursive(modelName, schema, objExample, 1, "", 0, new ArrayList<>()); + } + public String toExampleValue(Schema schema, Object objExample) { String modelName = getModelName(schema); return toExampleValueRecursive(modelName, schema, objExample, 1, "", 0, new ArrayList<>()); @@ -1445,12 +1472,66 @@ private String toExampleValueRecursive(String modelName, Schema schema, Object o } String refModelName = getModelName(schema); return toExampleValueRecursive(refModelName, refSchema, objExample, indentationLevel, prefix, exampleLine, includedSchemas); - } else if (ModelUtils.isNullType(schema) || isAnyTypeSchema(schema)) { + } 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. return fullPrefix + "None" + closeChars; + } else if (ModelUtils.isAnyType(schema)) { + /* + This schema may be a composed schema + TODO generate examples for some of these use cases in the future like + only oneOf without a discriminator + */ + Boolean hasProperties = (schema.getProperties() != null && !schema.getProperties().isEmpty()); + CodegenDiscriminator disc = createDiscriminator(modelName, schema, openAPI); + if (ModelUtils.isComposedSchema(schema)) { + // complex composed object type schemas not yet handled and the code returns early + if (hasProperties) { + // what if this composed schema defined properties + allOf? + // or items + properties, both a ist and a dict could be accepted as payloads + return fullPrefix + "{}" + closeChars; + } + ComposedSchema cs = (ComposedSchema) schema; + Integer allOfExists = 0; + if (cs.getAllOf() != null && !cs.getAllOf().isEmpty()) { + allOfExists = 1; + } + Integer anyOfExists = 0; + if (cs.getAnyOf() != null && !cs.getAnyOf().isEmpty()) { + anyOfExists = 1; + } + Integer oneOfExists = 0; + if (cs.getOneOf() != null && !cs.getOneOf().isEmpty()) { + oneOfExists = 1; + } + if (allOfExists + anyOfExists + oneOfExists > 1) { + // what if it needs one oneOf schema, one anyOf schema, and two allOf schemas? + return fullPrefix + "None" + closeChars; + } + // for now only oneOf with discriminator is supported + if (oneOfExists == 1 && disc != null) { + ; + } else { + return fullPrefix + "None" + closeChars; + } + } + if (disc != null) { + // a discriminator means that the type must be object + MappedModel mm = getDiscriminatorMappedModel(disc); + if (mm == null) { + return fullPrefix + "None" + closeChars; + } + String discPropNameValue = mm.getMappingName(); + String chosenModelName = mm.getModelName(); + Schema modelSchema = getModelNameToSchemaCache().get(chosenModelName); + CodegenProperty cp = new CodegenProperty(); + cp.setName(disc.getPropertyName()); + cp.setExample(discPropNameValue); + return exampleForObjectModel(modelSchema, fullPrefix, closeChars, cp, indentationLevel, exampleLine, closingIndentation, includedSchemas); + } + return fullPrefix + "None" + closeChars; } else if (ModelUtils.isBooleanSchema(schema)) { - if (objExample == null) { + if (example == null) { example = "True"; } else { if ("false".equalsIgnoreCase(objExample.toString())) { @@ -1460,60 +1541,82 @@ private String toExampleValueRecursive(String modelName, Schema schema, Object o } } return fullPrefix + example + closeChars; - } else if (ModelUtils.isDateSchema(schema)) { - if (objExample == null) { - example = pythonDate("1970-01-01"); - } else { - example = pythonDate(objExample); - } - return fullPrefix + example + closeChars; - } else if (ModelUtils.isDateTimeSchema(schema)) { - if (objExample == null) { - example = pythonDateTime("1970-01-01T00:00:00.00Z"); - } else { - example = pythonDateTime(objExample); - } - return fullPrefix + example + closeChars; - } else if (ModelUtils.isBinarySchema(schema)) { - if (objExample == null) { - example = "/path/to/file"; - } - example = "open('" + example + "', 'rb')"; - return fullPrefix + example + closeChars; - } else if (ModelUtils.isByteArraySchema(schema)) { - if (objExample == null) { - example = "'YQ=='"; - } - return fullPrefix + example + closeChars; } else if (ModelUtils.isStringSchema(schema)) { - if (objExample == null) { + if (example != null) { + return fullPrefix + ensureQuotes(example) + closeChars; + } + if (ModelUtils.isDateSchema(schema)) { + if (objExample == null) { + example = pythonDate("1970-01-01"); + } else { + example = pythonDate(objExample); + } + } else if (ModelUtils.isDateTimeSchema(schema)) { + if (objExample == null) { + example = pythonDateTime("1970-01-01T00:00:00.00Z"); + } else { + example = pythonDateTime(objExample); + } + } else if (ModelUtils.isBinarySchema(schema)) { + if (example == null) { + example = "/path/to/file"; + } + example = "open('" + example + "', 'rb')"; + return fullPrefix + example + closeChars; + } else if (ModelUtils.isByteArraySchema(schema)) { + if (objExample == null) { + example = "'YQ=='"; + } + } else if ("Number".equalsIgnoreCase(schema.getFormat())) { // a BigDecimal: - if ("Number".equalsIgnoreCase(schema.getFormat())) { - example = "2"; - return fullPrefix + example + closeChars; - } else if (StringUtils.isNotBlank(schema.getPattern())) { - String pattern = schema.getPattern(); - RgxGen rgxGen = new RgxGen(pattern); - // this seed makes it so if we have [a-z] we pick a - Random random = new Random(18); - String sample = rgxGen.generate(random); - // omit leading / and trailing /, omit trailing /i - Pattern valueExtractor = Pattern.compile("^/?(.+?)/?.?$"); - Matcher m = valueExtractor.matcher(sample); - if (m.find()) { - example = m.group(m.groupCount()); - } else { - example = ""; + example = "2"; + } else if (StringUtils.isNotBlank(schema.getPattern())) { + String pattern = schema.getPattern(); + /* + RxGen does not support our ECMA dialect https://github.com/curious-odd-man/RgxGen/issues/56 + So strip off the leading / and trailing / and turn on ignore case if we have it + */ + Pattern valueExtractor = Pattern.compile("^/?(.+?)/?(.?)$"); + Matcher m = valueExtractor.matcher(pattern); + RgxGen rgxGen = null; + if (m.find()) { + int groupCount = m.groupCount(); + if (groupCount == 1) { + // only pattern found + String isolatedPattern = m.group(1); + rgxGen = new RgxGen(isolatedPattern); + } else if (groupCount == 2) { + // patterns and flag found + String isolatedPattern = m.group(1); + String flags = m.group(2); + if (flags.contains("i")) { + rgxGen = new RgxGen(isolatedPattern); + RgxGenProperties properties = new RgxGenProperties(); + RgxGenOption.CASE_INSENSITIVE.setInProperties(properties, true); + rgxGen.setProperties(properties); + } else { + rgxGen = new RgxGen(isolatedPattern); + } } - } else if (schema.getMinLength() != null) { - example = ""; - int len = schema.getMinLength().intValue(); - for (int i = 0; i < len; i++) example += "a"; - } else if (ModelUtils.isUUIDSchema(schema)) { - example = "046b6c7f-0b8a-43b9-b35d-6489e6daee91"; } else { - example = "string_example"; + rgxGen = new RgxGen(pattern); + } + + // this seed makes it so if we have [a-z] we pick a + Random random = new Random(18); + if (rgxGen != null) { + example = rgxGen.generate(random); + } else { + throw new RuntimeException("rgxGen cannot be null. Please open an issue in the openapi-generator github repo."); } + } else if (schema.getMinLength() != null) { + example = ""; + int len = schema.getMinLength().intValue(); + for (int i = 0; i < len; i++) example += "a"; + } else if (ModelUtils.isUUIDSchema(schema)) { + example = "046b6c7f-0b8a-43b9-b35d-6489e6daee91"; + } else { + example = "string_example"; } return fullPrefix + ensureQuotes(example) + closeChars; } else if (ModelUtils.isIntegerSchema(schema)) { @@ -1537,7 +1640,11 @@ private String toExampleValueRecursive(String modelName, Schema schema, Object o } else if (ModelUtils.isArraySchema(schema)) { if (objExample instanceof Iterable) { // If the example is already a list, return it directly instead of wrongly wrap it in another list - return fullPrefix + objExample.toString(); + return fullPrefix + objExample.toString() + closeChars; + } + if (ModelUtils.isComposedSchema(schema)) { + // complex composed array type schemas not yet handled and the code returns early + return fullPrefix + "[]" + closeChars; } ArraySchema arrayschema = (ArraySchema) schema; Schema itemSchema = arrayschema.getItems(); @@ -1545,18 +1652,68 @@ private String toExampleValueRecursive(String modelName, Schema schema, Object o includedSchemas.add(schema); String itemExample = toExampleValueRecursive(itemModelName, itemSchema, objExample, indentationLevel + 1, "", exampleLine + 1, includedSchemas); if (StringUtils.isEmpty(itemExample) || cycleFound) { - return fullPrefix + "[]"; + return fullPrefix + "[]" + closeChars; } else { return fullPrefix + "[" + "\n" + itemExample + "\n" + closingIndentation + "]" + closeChars; } - } else if (ModelUtils.isMapSchema(schema)) { + } else if (ModelUtils.isTypeObjectSchema(schema)) { if (modelName == null) { fullPrefix += "dict("; closeChars = ")"; } + if (cycleFound) { + return fullPrefix + closeChars; + } + Boolean hasProperties = (schema.getProperties() != null && !schema.getProperties().isEmpty()); + CodegenDiscriminator disc = createDiscriminator(modelName, schema, openAPI); + if (ModelUtils.isComposedSchema(schema)) { + // complex composed object type schemas not yet handled and the code returns early + if (hasProperties) { + // what if this composed schema defined properties + allOf? + return fullPrefix + closeChars; + } + ComposedSchema cs = (ComposedSchema) schema; + Integer allOfExists = 0; + if (cs.getAllOf() != null && !cs.getAllOf().isEmpty()) { + allOfExists = 1; + } + Integer anyOfExists = 0; + if (cs.getAnyOf() != null && !cs.getAnyOf().isEmpty()) { + anyOfExists = 1; + } + Integer oneOfExists = 0; + if (cs.getOneOf() != null && !cs.getOneOf().isEmpty()) { + oneOfExists = 1; + } + if (allOfExists + anyOfExists + oneOfExists > 1) { + // what if it needs one oneOf schema, one anyOf schema, and two allOf schemas? + return fullPrefix + closeChars; + } + // for now only oneOf with discriminator is supported + if (oneOfExists == 1 && disc != null) { + ; + } else { + return fullPrefix + closeChars; + } + } + if (disc != null) { + MappedModel mm = getDiscriminatorMappedModel(disc); + if (mm == null) { + return fullPrefix + closeChars; + } + String discPropNameValue = mm.getMappingName(); + String chosenModelName = mm.getModelName(); + Schema modelSchema = getModelNameToSchemaCache().get(chosenModelName); + CodegenProperty cp = new CodegenProperty(); + cp.setName(disc.getPropertyName()); + cp.setExample(discPropNameValue); + return exampleForObjectModel(modelSchema, fullPrefix, closeChars, cp, indentationLevel, exampleLine, closingIndentation, includedSchemas); + } Object addPropsObj = schema.getAdditionalProperties(); - // TODO handle true case for additionalProperties - if (addPropsObj instanceof Schema && !cycleFound) { + if (hasProperties) { + return exampleForObjectModel(schema, fullPrefix, closeChars, null, indentationLevel, exampleLine, closingIndentation, includedSchemas); + } else if (addPropsObj instanceof Schema) { + // TODO handle true case for additionalProperties Schema addPropsSchema = (Schema) addPropsObj; String key = "key"; Object addPropsExample = getObjectExample(addPropsSchema); @@ -1574,51 +1731,6 @@ private String toExampleValueRecursive(String modelName, Schema schema, Object o } else { example = fullPrefix + closeChars; } - return example; - } else if (ModelUtils.isObjectSchema(schema)) { - if (modelName == null) { - fullPrefix += "dict("; - closeChars = ")"; - } - if (cycleFound) { - return fullPrefix + closeChars; - } - CodegenDiscriminator disc = createDiscriminator(modelName, schema, openAPI); - if (disc != null) { - MappedModel mm = getDiscriminatorMappedModel(disc); - if (mm != null) { - String discPropNameValue = mm.getMappingName(); - String chosenModelName = mm.getModelName(); - // TODO handle this case in the future, this is when the discriminated - // schema allOf includes this schema, like Cat allOf includes Pet - // so this is the composed schema use case - } else { - return fullPrefix + closeChars; - } - } - return exampleForObjectModel(schema, fullPrefix, closeChars, null, indentationLevel, exampleLine, closingIndentation, includedSchemas); - } else if (ModelUtils.isComposedSchema(schema)) { - if (cycleFound) { - return fullPrefix + closeChars; - } - // TODO add examples for composed schema models without discriminators - - CodegenDiscriminator disc = createDiscriminator(modelName, schema, openAPI); - if (disc != null) { - MappedModel mm = getDiscriminatorMappedModel(disc); - if (mm != null) { - String discPropNameValue = mm.getMappingName(); - String chosenModelName = mm.getModelName(); - Schema modelSchema = getModelNameToSchemaCache().get(chosenModelName); - CodegenProperty cp = new CodegenProperty(); - cp.setName(disc.getPropertyName()); - cp.setExample(discPropNameValue); - return exampleForObjectModel(modelSchema, fullPrefix, closeChars, cp, indentationLevel, exampleLine, closingIndentation, includedSchemas); - } else { - return fullPrefix + closeChars; - } - } - return fullPrefix + closeChars; } else { LOGGER.warn("Type " + schema.getType() + " not handled properly in toExampleValue"); } @@ -2204,4 +2316,16 @@ public void preprocessOpenAPI(OpenAPI openAPI) { throw new RuntimeException("Your spec version of "+originalSpecVersion+" is too low. python-experimental only works with specs with version >= 3.X.X. Please use a tool like Swagger Editor or Swagger Converter to convert your spec to v3"); } } + + @Override + public void postProcess() { + System.out.println("################################################################################"); + System.out.println("# Thanks for using OpenAPI Generator. #"); + System.out.println("# Please consider donation to help us maintain this project \uD83D\uDE4F #"); + System.out.println("# https://opencollective.com/openapi_generator/donate #"); + System.out.println("# #"); + System.out.println("# This generator was written by Justin Black (https://github.com/spacether) #"); + System.out.println("# Please support his work directly via https://github.com/sponsors/spacether \uD83D\uDE4F#"); + System.out.println("################################################################################"); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java index e18021962941..627e7ae10028 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java @@ -30,6 +30,8 @@ import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -188,12 +190,12 @@ public String getTypeDeclaration(Schema p) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); // Set will make sure that no duplicated items are used. Set securityImports = new HashSet<>(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (final CodegenOperation operation : ops) { List responses = operation.responses; if (responses != null) { @@ -230,7 +232,7 @@ public Map postProcessOperationsWithModels(Map o } } - objs.put("securityImports", new ArrayList(securityImports)); + objs.put("securityImports", new ArrayList<>(securityImports)); return objs; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java index 8cecb235cd3f..1e24fc3ad521 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java @@ -26,6 +26,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -689,16 +691,16 @@ public String toModelTestFilename(String name) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map objectMap = (Map) objs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap objectMap = objs.getOperations(); - HashMap modelMaps = new HashMap(); + HashMap modelMaps = new HashMap<>(); for (ModelMap modelMap : allModels) { CodegenModel m = modelMap.getModel(); modelMaps.put(m.classname, m); } - List operations = (List) objectMap.get("operation"); + List operations = objectMap.getOperation(); for (CodegenOperation operation : operations) { for (CodegenParameter cp : operation.allParams) { cp.vendorExtensions.put("x-r-example", constructExampleCode(cp, modelMaps)); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java index f95ab1ea4592..1ac9398c1aaa 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java @@ -23,6 +23,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -573,18 +575,18 @@ protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Sc } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); - Map operations = (Map) objs.get("operations"); - HashMap modelMaps = new HashMap(); - HashMap processedModelMaps = new HashMap(); + OperationMap operations = objs.getOperations(); + HashMap modelMaps = new HashMap<>(); + HashMap processedModelMaps = new HashMap<>(); for (ModelMap modelMap : allModels) { CodegenModel m = modelMap.getModel(); modelMaps.put(m.classname, m); } - List operationList = (List) operations.get("operation"); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { for (CodegenParameter p : op.allParams) { p.vendorExtensions.put("x-ruby-example", constructExampleCode(p, modelMaps, processedModelMaps)); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java index 82f6b012c79a..cde626ece1e4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java @@ -26,6 +26,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.StringUtils; import org.slf4j.Logger; @@ -525,11 +527,9 @@ public String toOperationId(String operationId) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - @SuppressWarnings("unchecked") - Map objectMap = (Map) objs.get("operations"); - @SuppressWarnings("unchecked") - List operations = (List) objectMap.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap objectMap = objs.getOperations(); + List operations = objectMap.getOperation(); for (CodegenOperation operation : operations) { // http method verb conversion, depending on client library (e.g. Hyper: PUT => Put, Reqwest: PUT => put) if (HYPER_LIBRARY.equals(getLibrary())) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java index 47e61ebe2fd6..c6d73c6c2ea5 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java @@ -33,8 +33,11 @@ import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; +import org.openapitools.codegen.model.ApiInfoMap; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.URLPathUtils; import org.slf4j.Logger; @@ -968,9 +971,9 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { postProcessOperationWithModels(op, allModels); @@ -1370,12 +1373,9 @@ public int compare(Map.Entry> a, Map.Entry bundle) { - Map apiInfo = (Map) bundle.get("apiInfo"); - List apis = (List) apiInfo.get("apis"); - for (Object api : apis) { - Map apiData = (Map) api; - Map opss = (Map) apiData.get("operations"); - List ops = (List) opss.get("operation"); + ApiInfoMap apiInfo = (ApiInfoMap) bundle.get("apiInfo"); + for (OperationsMap api : apiInfo.getApis()) { + List ops = api.getOperations().getOperation(); for (CodegenOperation op : ops) { if (!op.callbacks.isEmpty()) { return true; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java index fbcf40acc8d5..a74eabfcfe86 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java @@ -26,6 +26,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -212,13 +214,12 @@ public String escapeReservedWord(String name) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { if (registerNonStandardStatusCodes) { try { - @SuppressWarnings("unchecked") - Map> opsMap = (Map>) objs.get("operations"); - HashSet unknownCodes = new HashSet(); - for (CodegenOperation operation : opsMap.get("operation")) { + OperationMap opsMap = objs.getOperations(); + HashSet unknownCodes = new HashSet<>(); + for (CodegenOperation operation : opsMap.getOperation()) { for (CodegenResponse response : operation.responses) { if ("default".equals(response.code)) { continue; @@ -251,13 +252,7 @@ public List fromSecurity(Map schemes) { } // Remove OAuth securities - Iterator it = codegenSecurities.iterator(); - while (it.hasNext()) { - final CodegenSecurity security = it.next(); - if (security.isOAuth) { - it.remove(); - } - } + codegenSecurities.removeIf(security -> security.isOAuth); if (codegenSecurities.isEmpty()) { return null; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaHttpServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaHttpServerCodegen.java index 480f9ccab4bf..dd50aec48895 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaHttpServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaHttpServerCodegen.java @@ -26,6 +26,8 @@ import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -282,8 +284,8 @@ public CodegenParameter fromParameter(Parameter parameter, Set imports) @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map baseObjs = super.postProcessOperationsWithModels(objs, allModels); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationsMap baseObjs = super.postProcessOperationsWithModels(objs, allModels); pathMatcherPatternsPostProcessor(baseObjs); marshallingPostProcessor(baseObjs); return baseObjs; @@ -344,13 +346,12 @@ protected void addPathMatcher(CodegenOperation codegenOperation) { public static String PATH_MATCHER_PATTERNS_KEY = "pathMatcherPatterns"; - @SuppressWarnings("unchecked") - private static void pathMatcherPatternsPostProcessor(Map objs) { + private static void pathMatcherPatternsPostProcessor(OperationsMap objs) { if (objs != null) { HashMap patternMap = new HashMap<>(); - Map operations = (Map) objs.get("operations"); + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { for (CodegenParameter parameter : operation.pathParams) { if (parameter.pattern != null && !parameter.pattern.isEmpty()) { @@ -371,8 +372,7 @@ private static String pathMatcherPatternName(CodegenParameter parameter) { } // Responsible for setting up Marshallers/Unmarshallers - @SuppressWarnings("unchecked") - public static void marshallingPostProcessor(Map objs) { + public static void marshallingPostProcessor(OperationsMap objs) { if (objs == null) { return; @@ -384,9 +384,9 @@ public static void marshallingPostProcessor(Map objs) { boolean hasCookieParams = false; boolean hasMultipart = false; - Map operations = (Map) objs.get("operations"); + OperationMap operations = objs.getOperations(); if (operations != null) { - List operationList = (List) operations.get("operation"); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { boolean isMultipart = op.isMultipart; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaFinchServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaFinchServerCodegen.java index 45975268d628..4dde3ea3b6f2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaFinchServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaFinchServerCodegen.java @@ -22,6 +22,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -229,11 +231,10 @@ public String modelFileFolder() { return outputFolder + File.separator + sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar); } - @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { // Converts GET /foo/bar => get("foo" :: "bar") diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaLagomServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaLagomServerCodegen.java index 0d2ea418a1d8..c4d38de101c3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaLagomServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaLagomServerCodegen.java @@ -22,6 +22,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -202,9 +204,9 @@ public ModelsMap postProcessModelsEnum(ModelsMap objs) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - ArrayList oplist = (ArrayList) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List oplist = operations.getOperation(); for (CodegenOperation codegenOperation : oplist) { String path = codegenOperation.path; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java index 1e752dad4537..eaa7dcf08a34 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java @@ -23,8 +23,11 @@ import io.swagger.v3.oas.models.media.Schema; import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; +import org.openapitools.codegen.model.ApiInfoMap; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.templating.mustache.IndentedLambda; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; @@ -223,9 +226,8 @@ protected ImmutableMap.Builder addMustacheLambdas() { .put("indented_4", new IndentedLambda(4, " ")); } - @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { Map models = new HashMap<>(); for (ModelMap _mo : allModels) { @@ -233,9 +235,9 @@ public Map postProcessOperationsWithModels(Map o models.put(model.classname, _mo.getModel()); } - Map operations = (Map) objs.get("operations"); + OperationMap operations = objs.getOperations(); if (operations != null) { - List ops = (List) operations.get("operation"); + List ops = operations.getOperation(); for (CodegenOperation operation : ops) { Pattern pathVariableMatcher = Pattern.compile("\\{([^}]+)}"); Matcher match = pathVariableMatcher.matcher(operation.path); @@ -277,18 +279,15 @@ public Map postProcessAllModels(Map objs) return objs; } - @SuppressWarnings("unchecked") @Override public Map postProcessSupportingFileData(Map objs) { objs = super.postProcessSupportingFileData(objs); generateJSONSpecFile(objs); // Prettify routes file - Map apiInfo = (Map) objs.get("apiInfo"); - List> apis = (List>) apiInfo.get("apis"); - List ops = apis.stream() - .map(api -> (Map) api.get("operations")) - .flatMap(operations -> ((List) operations.get("operation")).stream()) + ApiInfoMap apiInfo = (ApiInfoMap) objs.get("apiInfo"); + List ops = apiInfo.getApis().stream() + .flatMap(api -> api.getOperations().getOperation().stream()) .collect(Collectors.toList()); int maxPathLength = ops.stream() .mapToInt(op -> op.httpMethod.length() + op.path.length()) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaSttpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaSttpClientCodegen.java index 7e3e2d383573..0d3c45fd9b8d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaSttpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaSttpClientCodegen.java @@ -30,6 +30,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -313,13 +315,12 @@ private boolean isEnumClass(final String importPath, final Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { if (registerNonStandardStatusCodes) { try { - @SuppressWarnings("unchecked") - Map> opsMap = (Map>) objs.get("operations"); - HashSet unknownCodes = new HashSet(); - for (CodegenOperation operation : opsMap.get("operation")) { + OperationMap opsMap = objs.getOperations(); + HashSet unknownCodes = new HashSet<>(); + for (CodegenOperation operation : opsMap.getOperation()) { for (CodegenResponse response : operation.responses) { if ("default".equals(response.code)) { continue; @@ -352,13 +353,7 @@ public List fromSecurity(Map schemes) { } // Remove OAuth securities - Iterator it = codegenSecurities.iterator(); - while (it.hasNext()) { - final CodegenSecurity security = it.next(); - if (security.isOAuth) { - it.remove(); - } - } + codegenSecurities.removeIf(security -> security.isOAuth); if (codegenSecurities.isEmpty()) { return null; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalatraServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalatraServerCodegen.java index 44249acf2b48..b22533ff2ccf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalatraServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalatraServerCodegen.java @@ -20,6 +20,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import java.io.File; import java.util.*; @@ -167,9 +169,9 @@ public String getHelp() { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { // force http method to lower case op.httpMethod = op.httpMethod.toLowerCase(Locale.ROOT); 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 4708e10e4915..4067c83c76b8 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 @@ -32,9 +32,12 @@ import java.util.Arrays; import java.util.EnumSet; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Objects; +import java.util.Set; import java.util.regex.Matcher; import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.Pair; @@ -62,6 +65,8 @@ import org.openapitools.codegen.meta.features.WireFormatFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.templating.mustache.SplitStringLambda; import org.openapitools.codegen.templating.mustache.TrimWhitespaceLambda; import org.openapitools.codegen.utils.URLPathUtils; @@ -622,10 +627,10 @@ public void preprocessOpenAPI(OpenAPI openAPI) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - final Map operations = (Map) objs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + final OperationMap operations = objs.getOperations(); if (operations != null) { - final List ops = (List) operations.get("operation"); + final List ops = operations.getOperation(); for (final CodegenOperation operation : ops) { final List responses = operation.responses; if (responses != null) { @@ -882,9 +887,67 @@ public CodegenModel fromModel(String name, Schema model) { codegenModel.imports.remove("ApiModelProperty"); codegenModel.imports.remove("ApiModel"); } + return codegenModel; } + /** + * Analyse and post process all Models. + * Add parentVars to every Model which has a parent. This allows to generate + * fluent setter methods for inherited properties. + * @param objs the models map. + * @return the processed models map. + */ + @Override + public Map postProcessAllModels(Map objs) { + objs = super.postProcessAllModels(objs); + objs = super.updateAllModels(objs); + + for (ModelsMap modelsAttrs : objs.values()) { + for (ModelMap mo : modelsAttrs.getModels()) { + CodegenModel codegenModel = mo.getModel(); + Set inheritedImports = new HashSet<>(); + Map propertyHash = new HashMap<>(codegenModel.vars.size()); + for (final CodegenProperty property : codegenModel.vars) { + propertyHash.put(property.name, property); + } + CodegenModel parentCodegenModel = codegenModel.parentModel; + while (parentCodegenModel != null) { + for (final CodegenProperty property : parentCodegenModel.vars) { + // helper list of parentVars simplifies templating + if (!propertyHash.containsKey(property.name)) { + propertyHash.put(property.name, property); + final CodegenProperty parentVar = property.clone(); + parentVar.isInherited = true; + LOGGER.info("adding parent variable {}", property.name); + codegenModel.parentVars.add(parentVar); + Set imports = parentVar.getImports(true).stream().filter(Objects::nonNull).collect(Collectors.toSet()); + for (String imp: imports) { + // Avoid dupes + if (!codegenModel.getImports().contains(imp)) { + inheritedImports.add(imp); + codegenModel.getImports().add(imp); + } + } + } + } + parentCodegenModel = parentCodegenModel.getParentModel(); + } + // There must be a better way ... + for (String imp: inheritedImports) { + String qimp = importMapping().get(imp); + if (qimp != null) { + Map toAdd = new HashMap<>(); + toAdd.put("import", qimp); + modelsAttrs.getImports().add(toAdd); + } + } + } + } + return objs; + } + + /* * Add dynamic imports based on the parameters and vendor extensions of an operation. * The imports are expanded by the mustache {{import}} tag available to model and api diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java index 4e5d92b6be62..b2210f39f51a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java @@ -29,6 +29,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.Markdown; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; @@ -142,9 +144,9 @@ public String getTypeDeclaration(Schema p) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { op.httpMethod = op.httpMethod.toLowerCase(Locale.ROOT); for (CodegenResponse response : op.responses) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtmlGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtmlGenerator.java index d2fe4759c57f..63457b57d7d7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtmlGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtmlGenerator.java @@ -26,6 +26,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.Markdown; import org.openapitools.codegen.utils.ModelUtils; @@ -125,9 +127,9 @@ public String getTypeDeclaration(Schema p) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { op.httpMethod = op.httpMethod.toLowerCase(Locale.ROOT); for (CodegenResponse response : op.responses) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java index d4bd6237555b..08afea2fa608 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java @@ -28,6 +28,8 @@ import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1182,16 +1184,16 @@ public void postProcessFile(File file, String fileType) { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - Map objectMap = (Map) objs.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationMap objectMap = objs.getOperations(); - HashMap modelMaps = new HashMap(); + HashMap modelMaps = new HashMap<>(); for (ModelMap modelMap: allModels) { CodegenModel m = modelMap.getModel(); modelMaps.put(m.classname, m); } - List operations = (List) objectMap.get("operation"); + List operations = objectMap.getOperation(); for (CodegenOperation operation : operations) { for (CodegenParameter cp : operation.allParams) { cp.vendorExtensions.put("x-swift-example", constructExampleCode(cp, modelMaps, new HashSet<>())); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java index 7b7a6102f1a2..73903cdf9592 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java @@ -22,6 +22,8 @@ import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.SemVer; import org.slf4j.Logger; @@ -385,13 +387,13 @@ public void postProcessParameter(CodegenParameter parameter) { } @Override - public Map postProcessOperationsWithModels(Map operations, List allModels) { - Map objs = (Map) operations.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap operations, List allModels) { + OperationMap objs = operations.getOperations(); // Add filename information for api imports - objs.put("apiFilename", getApiFilenameFromClassname(objs.get("classname").toString())); + objs.put("apiFilename", getApiFilenameFromClassname(objs.getClassname())); - List ops = (List) objs.get("operation"); + List ops = objs.getOperation(); boolean hasSomeFormParams = false; for (CodegenOperation op : ops) { if (op.getHasFormParams()) { @@ -446,8 +448,8 @@ public Map postProcessOperationsWithModels(Map o operations.put("hasSomeFormParams", hasSomeFormParams); // Add additional filename information for model imports in the services - List> imports = (List>) operations.get("imports"); - for (Map im : imports) { + List> imports = operations.getImports(); + for (Map im : imports) { // This property is not used in the templates any more, subject for removal im.put("filename", im.get("import")); im.put("classname", im.get("classname")); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAureliaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAureliaClientCodegen.java index e0479d1daadc..be3224dbb7f6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAureliaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAureliaClientCodegen.java @@ -20,6 +20,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import java.util.*; @@ -84,12 +86,12 @@ public void processOpts() { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); HashSet modelImports = new HashSet<>(); - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { // Aurelia uses "asGet", "asPost", ... methods; change the method format op.httpMethod = camelize(op.httpMethod.toLowerCase(Locale.ROOT)); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java index a0083a1e4b18..41574681763b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java @@ -24,6 +24,8 @@ import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import java.util.*; @@ -145,10 +147,10 @@ public void processOpts() { } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); - Map vals = (Map) objs.getOrDefault("operations", new HashMap<>()); - List operations = (List) vals.getOrDefault("operation", new ArrayList<>()); + OperationMap vals = objs.getOperations(); + List operations = vals.getOperation(); /* Filter all the operations that are multipart/form-data operations and set the vendor extension flag 'multipartFormData' for the template to work with. @@ -156,9 +158,7 @@ public Map postProcessOperationsWithModels(Map o operations.stream() .filter(op -> op.hasConsumes) .filter(op -> op.consumes.stream().anyMatch(opc -> opc.values().stream().anyMatch("multipart/form-data"::equals))) - .forEach(op -> { - op.vendorExtensions.putIfAbsent("multipartFormData", true); - }); + .forEach(op -> op.vendorExtensions.putIfAbsent("multipartFormData", true)); return objs; } @@ -191,7 +191,6 @@ protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Sc } @Override - @SuppressWarnings("unchecked") public ModelsMap postProcessModels(ModelsMap objs) { List models = postProcessModelsEnum(objs).getModels(); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java index e60af80b95ad..d7a2af88dfe1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java @@ -35,6 +35,8 @@ import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -318,18 +320,17 @@ public Map postProcessSupportingFileData(Map obj } @Override - public Map postProcessOperationsWithModels(Map operations, List models) { + public OperationsMap postProcessOperationsWithModels(OperationsMap operations, List models) { // Add additional filename information for model imports in the apis - List> imports = (List>) operations.get("imports"); - for (Map im : imports) { - im.put("filename", ((String) im.get("import")).replace(".", "/")); - im.put("classname", getModelnameFromModelFilename(im.get("import").toString())); + List> imports = operations.getImports(); + for (Map im : imports) { + im.put("filename", im.get("import").replace(".", "/")); + im.put("classname", getModelnameFromModelFilename(im.get("import"))); } - @SuppressWarnings("unchecked") - Map operationsMap = (Map) operations.get("operations"); - List operationList = (List) operationsMap.get("operation"); + OperationMap operationsMap = operations.getOperations(); + List operationList = operationsMap.getOperation(); for (CodegenOperation operation: operationList) { List responses = operation.responses; operation.returnType = this.getReturnType(responses); 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 d8c056405b25..1f00bce4a3e1 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 @@ -30,6 +30,8 @@ import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.templating.mustache.IndentedLambda; import org.openapitools.codegen.utils.ModelUtils; @@ -572,9 +574,9 @@ public String escapeReservedWord(String name) { } @Override - public Map postProcessOperationsWithModels(Map operations, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap operations, List allModels) { // Add supporting file only if we plan to generate files in /apis - if (operations.size() > 0 && !addedApiIndex) { + if (!operations.isEmpty() && !addedApiIndex) { addedApiIndex = true; supportingFiles.add(new SupportingFile("apis.index.mustache", apiPackage().replace('.', File.separatorChar), "index.ts")); if (this.getSagasAndRecords()) { @@ -584,7 +586,7 @@ public Map postProcessOperationsWithModels(Map o } // Add supporting file only if we plan to generate files in /models - if (allModels.size() > 0 && !addedModelIndex) { + if (!allModels.isEmpty() && !addedModelIndex) { addedModelIndex = true; supportingFiles.add(new SupportingFile("models.index.mustache", modelPackage().replace('.', File.separatorChar), "index.ts")); } @@ -763,10 +765,9 @@ private boolean itemsAreNullable(ExtendedCodegenProperty var) { return var.items.isNullable || (var.items.items != null && var.items.items.isNullable); } - private void escapeOperationIds(Map operations) { - Map _operations = (Map) operations.get("operations"); - List operationList = (List) _operations.get("operation"); - for (ExtendedCodegenOperation op : operationList) { + private void escapeOperationIds(OperationsMap operations) { + for (CodegenOperation _op : operations.getOperations().getOperation()) { + ExtendedCodegenOperation op = (ExtendedCodegenOperation) _op; String param = op.operationIdCamelCase + "Request"; if (op.imports.contains(param)) { // we import a model with the same name as the generated operation, escape it @@ -777,26 +778,25 @@ private void escapeOperationIds(Map operations) { } } - private void addOperationModelImportInformation(Map operations) { + private void addOperationModelImportInformation(OperationsMap operations) { // This method will add extra information to the operations.imports array. // The api template uses this information to import all the required // models for a given operation. - List> imports = (List>) operations.get("imports"); - List existingRecordClassNames = new ArrayList(); - List existingClassNames = new ArrayList(); - for (Map im : imports) { - String className = im.get("import").toString().replace(modelPackage() + ".", ""); + List> imports = operations.getImports(); + List existingRecordClassNames = new ArrayList<>(); + List existingClassNames = new ArrayList<>(); + for (Map im : imports) { + String className = im.get("import").replace(modelPackage() + ".", ""); existingClassNames.add(className); existingRecordClassNames.add(className + "Record"); im.put("className", className); } if (this.getSagasAndRecords()) { - Map _operations = (Map) operations.get("operations"); - List operationList = (List) _operations.get("operation"); - Set additionalPassthroughImports = new TreeSet(); - for (ExtendedCodegenOperation op : operationList) { - if (op.returnPassthrough != null && op.returnBaseTypeAlternate instanceof String) { + Set additionalPassthroughImports = new TreeSet<>(); + for (CodegenOperation _op : operations.getOperations().getOperation()) { + ExtendedCodegenOperation op = (ExtendedCodegenOperation) _op; + if (op.returnPassthrough != null && op.returnBaseTypeAlternate != null) { if (op.returnTypeSupportsEntities && !existingRecordClassNames.contains(op.returnBaseTypeAlternate)) { additionalPassthroughImports.add(op.returnBaseTypeAlternate); } else if (!op.returnTypeSupportsEntities && !existingClassNames.contains(op.returnBaseTypeAlternate)) { @@ -809,14 +809,13 @@ private void addOperationModelImportInformation(Map operations) } } - private void updateOperationParameterForEnum(Map operations) { + private void updateOperationParameterForEnum(OperationsMap operations) { // This method will add extra information as to whether or not we have enums and // update their names with the operation.id prefixed. // It will also set the uniqueId status if provided. - Map _operations = (Map) operations.get("operations"); - List operationList = (List) _operations.get("operation"); boolean hasEnum = false; - for (ExtendedCodegenOperation op : operationList) { + for (CodegenOperation _op : operations.getOperations().getOperation()) { + ExtendedCodegenOperation op = (ExtendedCodegenOperation) _op; for (CodegenParameter cpParam : op.allParams) { ExtendedCodegenParameter param = (ExtendedCodegenParameter) cpParam; @@ -831,13 +830,12 @@ private void updateOperationParameterForEnum(Map operations) { operations.put("hasEnums", hasEnum); } - private void updateOperationParameterForSagaAndRecords(Map operations) { + private void updateOperationParameterForSagaAndRecords(OperationsMap operations) { // This method will add extra information as to whether or not we have enums and // update their names with the operation.id prefixed. // It will also set the uniqueId status if provided. - Map _operations = (Map) operations.get("operations"); - List operationList = (List) _operations.get("operation"); - for (ExtendedCodegenOperation op : operationList) { + for (CodegenOperation _op : operations.getOperations().getOperation()) { + ExtendedCodegenOperation op = (ExtendedCodegenOperation) _op; for (CodegenParameter cpParam : op.allParams) { ExtendedCodegenParameter param = (ExtendedCodegenParameter) cpParam; @@ -881,13 +879,12 @@ private void updateOperationParameterForSagaAndRecords(Map opera } } - private void addOperationObjectResponseInformation(Map operations) { + private void addOperationObjectResponseInformation(OperationsMap operations) { // This method will modify the information on the operations' return type. // The api template uses this information to know when to return a text // response for a given simple response operation. - Map _operations = (Map) operations.get("operations"); - List operationList = (List) _operations.get("operation"); - for (ExtendedCodegenOperation op : operationList) { + for (CodegenOperation _op : operations.getOperations().getOperation()) { + ExtendedCodegenOperation op = (ExtendedCodegenOperation) _op; if ("object".equals(op.returnType)) { op.isMap = true; op.returnSimpleType = false; @@ -896,7 +893,6 @@ private void addOperationObjectResponseInformation(Map operation } private void addOperationPrefixParameterInterfacesInformation(Map operations) { - Map _operations = (Map) operations.get("operations"); operations.put("prefixParameterInterfaces", getPrefixParameterInterfaces()); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java index 6f7ddbb3c5a4..6fdb5f0d1698 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java @@ -25,6 +25,8 @@ import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import java.io.File; import java.util.*; @@ -197,13 +199,13 @@ public void postProcessParameter(CodegenParameter parameter) { } @Override - public Map postProcessOperationsWithModels(Map operations, List allModels) { - Map objs = (Map) operations.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap operations, List allModels) { + OperationMap objs = operations.getOperations(); // Add filename information for api imports - objs.put("apiFilename", getApiFilenameFromClassname(objs.get("classname").toString())); + objs.put("apiFilename", getApiFilenameFromClassname(objs.getClassname())); - List ops = (List) objs.get("operation"); + List ops = objs.getOperation(); for (CodegenOperation op : ops) { // Prep a string buffer where we're going to set up our new version of the string. StringBuilder pathBuffer = new StringBuilder(); @@ -246,10 +248,10 @@ public Map postProcessOperationsWithModels(Map o } // Add additional filename information for model imports in the services - List> imports = (List>) operations.get("imports"); - for (Map im : imports) { + List> imports = operations.getImports(); + for (Map im : imports) { im.put("filename", im.get("import")); - im.put("classname", getModelnameFromModelFilename(im.get("filename").toString())); + im.put("classname", getModelnameFromModelFilename(im.get("filename"))); } return operations; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java index a79d6627fca7..5814238c94d8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java @@ -22,6 +22,8 @@ import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.SemVer; import org.slf4j.Logger; @@ -267,13 +269,13 @@ public void postProcessParameter(CodegenParameter parameter) { } @Override - public Map postProcessOperationsWithModels(Map operations, List allModels) { - Map objs = (Map) operations.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap operations, List allModels) { + OperationMap objs = operations.getOperations(); // Add filename information for api imports - objs.put("apiFilename", getApiFilenameFromClassname(objs.get("classname").toString())); + objs.put("apiFilename", getApiFilenameFromClassname(objs.getClassname())); - List ops = (List) objs.get("operation"); + List ops = objs.getOperation(); boolean hasSomeFormParams = false; for (CodegenOperation op : ops) { if (op.getHasFormParams()) { @@ -327,8 +329,8 @@ public Map postProcessOperationsWithModels(Map o operations.put("hasSomeFormParams", hasSomeFormParams); // Add additional filename information for model imports in the services - List> imports = (List>) operations.get("imports"); - for (Map im : imports) { + List> imports = operations.getImports(); + for (Map im : imports) { im.put("filename", im.get("import")); im.put("classname", im.get("classname")); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java index 2b761abafd92..a0685ecbe989 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java @@ -25,6 +25,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -198,13 +200,13 @@ private List> toTsImports(CodegenModel cm, Set impor } @Override - public Map postProcessOperationsWithModels(Map operations, List allModels) { - Map objs = (Map) operations.get("operations"); + public OperationsMap postProcessOperationsWithModels(OperationsMap operations, List allModels) { + OperationMap objs = operations.getOperations(); // The api.mustache template requires all of the auth methods for the whole api // Loop over all the operations and pick out each unique auth method Map authMethodsMap = new HashMap<>(); - for (CodegenOperation op : (List) objs.get("operation")) { + for (CodegenOperation op : objs.getOperation()) { if (op.hasAuthMethods) { for (CodegenSecurity sec : op.authMethods) { authMethodsMap.put(sec.name, sec); @@ -219,12 +221,12 @@ public Map postProcessOperationsWithModels(Map o } // Add filename information for api imports - objs.put("apiFilename", getApiFilenameFromClassname(objs.get("classname").toString())); + objs.put("apiFilename", getApiFilenameFromClassname(objs.getClassname())); // Add additional filename information for model imports in the apis - List> imports = (List>) operations.get("imports"); - for (Map im : imports) { - im.put("filename", im.get("import").toString()); + List> imports = operations.getImports(); + for (Map im : imports) { + im.put("filename", im.get("import")); } return operations; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptReduxQueryClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptReduxQueryClientCodegen.java index 3160d494c499..a4c13dbbe028 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptReduxQueryClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptReduxQueryClientCodegen.java @@ -22,6 +22,7 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import java.io.File; @@ -185,15 +186,15 @@ private void addNpmPackageGeneration() { } @Override - public Map postProcessOperationsWithModels(Map operations, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap operations, List allModels) { // Add supporting file only if we plan to generate files in /apis - if (operations.size() > 0 && !addedApiIndex) { + if (!operations.isEmpty() && !addedApiIndex) { addedApiIndex = true; supportingFiles.add(new SupportingFile("apis.index.mustache", apiPackage().replace('.', File.separatorChar), "index.ts")); } // Add supporting file only if we plan to generate files in /models - if (allModels.size() > 0 && !addedModelIndex) { + if (!allModels.isEmpty() && !addedModelIndex) { addedModelIndex = true; supportingFiles.add(new SupportingFile("models.index.mustache", modelPackage().replace('.', File.separatorChar), "index.ts")); } @@ -204,13 +205,13 @@ public Map postProcessOperationsWithModels(Map o return operations; } - private void addOperationModelImportInformation(Map operations) { + private void addOperationModelImportInformation(OperationsMap operations) { // This method will add extra information to the operations.imports array. // The api template uses this information to import all the required // models for a given operation. - List> imports = (List>) operations.get("imports"); - for (Map im : imports) { - String[] parts = im.get("import").toString().replace(modelPackage() + ".", "").split("( [|&] )|[<>]"); + List> imports = operations.getImports(); + for (Map im : imports) { + String[] parts = im.get("import").replace(modelPackage() + ".", "").split("( [|&] )|[<>]"); for (String s : parts) { if (needToImport(s)) { im.put("filename", im.get("import")); @@ -220,13 +221,11 @@ private void addOperationModelImportInformation(Map operations) } } - private void updateOperationParameterEnumInformation(Map operations) { + private void updateOperationParameterEnumInformation(OperationsMap operations) { // This method will add extra information as to whether or not we have enums and // update their names with the operation.id prefixed. - Map _operations = (Map) operations.get("operations"); - List operationList = (List) _operations.get("operation"); boolean hasEnum = false; - for (CodegenOperation op : operationList) { + for (CodegenOperation op : operations.getOperations().getOperation()) { for (CodegenParameter param : op.allParams) { if (Boolean.TRUE.equals(param.isEnum)) { hasEnum = true; @@ -239,13 +238,11 @@ private void updateOperationParameterEnumInformation(Map operati operations.put("hasEnums", hasEnum); } - private void addOperationObjectResponseInformation(Map operations) { + private void addOperationObjectResponseInformation(OperationsMap operations) { // This method will modify the information on the operations' return type. // The api template uses this information to know when to return a text // response for a given simple response operation. - Map _operations = (Map) operations.get("operations"); - List operationList = (List) _operations.get("operation"); - for (CodegenOperation op : operationList) { + for (CodegenOperation op : operations.getOperations().getOperation()) { if("object".equals(op.returnType)) { op.isMap = true; op.returnSimpleType = false; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptRxjsClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptRxjsClientCodegen.java index 0cbd2be7c21e..e9091517b3bf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptRxjsClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptRxjsClientCodegen.java @@ -23,6 +23,7 @@ import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -196,15 +197,14 @@ private void addNpmPackageGeneration() { } @Override - public Map postProcessOperationsWithModels(Map operations, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap operations, List allModels) { // Convert List of CodegenOperation to List of ExtendedCodegenOperation - Map _operations = (Map) operations.get("operations"); - List os = (List) _operations.get("operation"); - List newOs = new ArrayList(); + List os = operations.getOperations().getOperation(); + List newOs = new ArrayList<>(); for (CodegenOperation o : os) { newOs.add(new ExtendedCodegenOperation(o)); } - _operations.put("operation", newOs); + operations.getOperations().setOperation(newOs); this.addOperationModelImportInformation(operations); this.updateOperationParameterEnumInformation(operations); @@ -213,23 +213,22 @@ public Map postProcessOperationsWithModels(Map o return operations; } - private void addOperationModelImportInformation(Map operations) { + private void addOperationModelImportInformation(OperationsMap operations) { // This method will add extra information to the operations.imports array. // The api template uses this information to import all the required // models for a given operation. - List> imports = (List>) operations.get("imports"); - for (Map im : imports) { - im.put("className", im.get("import").toString().replace("models.", "")); + List> imports = operations.getImports(); + for (Map im : imports) { + im.put("className", im.get("import").replace("models.", "")); } } - private void updateOperationParameterEnumInformation(Map operations) { + private void updateOperationParameterEnumInformation(OperationsMap operations) { // This method will add extra information as to whether or not we have enums and // update their names with the operation.id prefixed. - Map _operations = (Map) operations.get("operations"); - List operationList = (List) _operations.get("operation"); boolean hasEnums = false; - for (ExtendedCodegenOperation op : operationList) { + for (CodegenOperation _op : operations.getOperations().getOperation()) { + ExtendedCodegenOperation op = (ExtendedCodegenOperation) _op; for (CodegenParameter param : op.allParams) { if (Boolean.TRUE.equals(param.isEnum)) { hasEnums = true; @@ -249,10 +248,8 @@ private void setParamNameAlternative(CodegenParameter param, String paramName, S } } - private void addConditionalImportInformation(Map operations) { + private void addConditionalImportInformation(OperationsMap operations) { // This method will determine if there are required parameters and if there are list containers - Map _operations = (Map) operations.get("operations"); - List operationList = (List) _operations.get("operation"); boolean hasRequiredParams = false; boolean hasListContainers = false; @@ -260,7 +257,8 @@ private void addConditionalImportInformation(Map operations) { boolean hasQueryParams = false; boolean hasPathParams = false; - for (ExtendedCodegenOperation op : operationList) { + for (CodegenOperation _op : operations.getOperations().getOperation()) { + ExtendedCodegenOperation op = (ExtendedCodegenOperation) _op; if (op.getHasRequiredParams()) { hasRequiredParams = true; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/WsdlSchemaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/WsdlSchemaCodegen.java index bd803f4b97cb..0a35197f954b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/WsdlSchemaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/WsdlSchemaCodegen.java @@ -23,6 +23,7 @@ import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationsMap; import java.io.File; import java.text.Normalizer; @@ -94,12 +95,8 @@ public String processOpenapiSpecDescription(String description) { } @Override - public Map postProcessOperationsWithModels(Map objs, - List allModels) { - - Map operations = (Map) objs.get("operations"); - List operationList = (List) operations.get("operation"); - for (CodegenOperation op : operationList) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + for (CodegenOperation op : objs.getOperations().getOperation()) { op.operationId = this.generateOperationId(op); // for xml compliant primitives, lowercase dataType of openapi diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/model/ApiInfoMap.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/model/ApiInfoMap.java new file mode 100644 index 000000000000..249ef9b437f7 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/model/ApiInfoMap.java @@ -0,0 +1,17 @@ +package org.openapitools.codegen.model; + +import java.util.HashMap; +import java.util.List; + +public class ApiInfoMap extends HashMap { + + public void setApis(List apis) { + put("apis", apis); + } + + @SuppressWarnings("unchecked") + public List getApis() { + return (List) get("apis"); + } + +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/model/OperationMap.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/model/OperationMap.java new file mode 100644 index 000000000000..1d8806508e3e --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/model/OperationMap.java @@ -0,0 +1,40 @@ +package org.openapitools.codegen.model; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; + +import org.openapitools.codegen.CodegenOperation; + +public class OperationMap extends HashMap { + + public void setOperation(CodegenOperation ops) { + put("operation", Collections.singletonList(ops)); + } + + public void setOperation(List ops) { + put("operation", ops); + } + + @SuppressWarnings("unchecked") + public List getOperation() { + return (List) get("operation"); + } + + public void setClassname(String classname) { + put("classname", classname); + } + + public String getClassname() { + return (String) get("classname"); + } + + public void setPathPrefix(String pathPrefix) { + put("pathPrefix", pathPrefix); + } + + public String getPathPrefix() { + return (String) get("pathPrefix"); + } + +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/model/OperationsMap.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/model/OperationsMap.java new file mode 100644 index 000000000000..2a24644cbfc1 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/model/OperationsMap.java @@ -0,0 +1,30 @@ +package org.openapitools.codegen.model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.codegen.CodegenOperation; + +public class OperationsMap extends HashMap { + + public void setOperation(OperationMap objs) { + put("operations", objs); + } + + public OperationMap getOperations() { + return (OperationMap) get("operations"); + } + + public void setImports(List> imports) { + put("imports", imports); + } + + @SuppressWarnings("unchecked") + public List> getImports() { + return (List>) get("imports"); + } + +} 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 699c074633f5..8787b70867b9 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 @@ -1200,12 +1200,11 @@ public static Schema getAdditionalProperties(OpenAPI openAPI, Schema schema) { */ } if (addProps == null || (addProps instanceof Boolean && (Boolean) addProps)) { - // Return ObjectSchema to specify any object (map) value is allowed. - // Set nullable to specify the value of additional properties may be - // the null value. - // Free-form additionalProperties don't need to have an inner - // additional properties, the type is already free-form. - return new ObjectSchema().additionalProperties(Boolean.FALSE).nullable(Boolean.TRUE); + // Return an empty schema as the properties can take on any type per + // the spec. See + // https://github.com/OpenAPITools/openapi-generator/issues/9282 for + // more details. + return new Schema(); } return null; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalData.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalData.java index e77bec480e13..556f696c7834 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalData.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalData.java @@ -1,16 +1,17 @@ package org.openapitools.codegen.utils; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenModel; import org.openapitools.codegen.CodegenProperty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * This class holds data to add to `oneOf` members. Let's consider this example: * @@ -69,15 +70,19 @@ public void addFromInterfaceModel(CodegenModel cm, List> mod // Add all vars defined on cm // a "oneOf" model (cm) by default inherits all properties from its "interfaceModels", // but we only want to add properties defined on cm itself - List toAdd = new ArrayList(cm.vars); + List toAdd = new ArrayList<>(cm.vars); + // note that we can't just toAdd.removeAll(m.vars) for every interfaceModel, // as they might have different value of `hasMore` and thus are not equal - List omitAdding = new ArrayList(); + Set omitAdding = new HashSet<>(); if (cm.interfaceModels != null) { for (CodegenModel m : cm.interfaceModels) { for (CodegenProperty v : m.vars) { omitAdding.add(v.baseName); } + for (CodegenProperty v : m.allVars) { + omitAdding.add(v.baseName); + } } } for (CodegenProperty v : toAdd) { @@ -89,7 +94,7 @@ public void addFromInterfaceModel(CodegenModel cm, List> mod // Add all imports of cm for (Map importMap : modelsImports) { // we're ok with shallow clone here, because imports are strings only - additionalImports.add(new HashMap(importMap)); + additionalImports.add(new HashMap<>(importMap)); } } @@ -120,6 +125,7 @@ public void addToImplementor(CodegenConfig cc, CodegenModel implcm, List oneImport : additionalImports) { diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/api-body.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/api-body.mustache index 7ee11c71fbcd..4a0c6c116b95 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/api-body.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/api-body.mustache @@ -326,9 +326,10 @@ end: "{{{httpMethod}}}"); {{#responses}} - if (apiClient->response_code == {{code}}) { - printf("%s\n","{{message}}"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == {{code}}) { + // printf("%s\n","{{message}}"); + //} {{/responses}} {{#returnType}} {{#returnTypeIsPrimitive}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache index cd9b33484db9..6761c4fcd99c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache @@ -100,13 +100,13 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.6.5" jackson_version = "2.13.2" - jackson_databind_version = "2.13.2" + jackson_databind_version = "2.13.2.2" {{#openApiNullable}} jackson_databind_nullable_version = "0.2.2" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" jersey_version = "2.35" - junit_version = "4.13.2" + junit_version = "5.8.2" {{#hasOAuthMethods}} scribejava_apis_version = "8.3.1" {{/hasOAuthMethods}} @@ -140,7 +140,12 @@ dependencies { implementation "org.tomitribe:tomitribe-http-signatures:$tomitribe_http_signatures_version" {{/hasHttpSignatureMethods}} implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +} + +test { + useJUnitPlatform() } javadoc { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache index f2a2b1225c51..9f3fcfce424e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache @@ -18,11 +18,11 @@ lazy val root = (project in file(".")). "org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.35", "com.fasterxml.jackson.core" % "jackson-core" % "2.13.2" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.2" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2.2" % "compile", {{#joda}} - "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.13.0" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.13.2" % "compile", {{/joda}} - "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.2" % "compile", {{#openApiNullable}} "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", {{/openApiNullable}} @@ -33,7 +33,6 @@ lazy val root = (project in file(".")). "org.tomitribe" % "tomitribe-http-signatures" % "1.7" % "compile", {{/hasHttpSignatureMethods}} "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.2" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test" + "org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test" ) ) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache index f7cbee700038..dc09b1e5422e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache @@ -383,7 +383,7 @@ 1.6.5 2.35 2.13.2 - 2.13.2 + 2.13.2.2 0.2.2 1.3.5 {{#useBeanValidation}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/AbstractOpenApiSchema.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/AbstractOpenApiSchema.mustache new file mode 100644 index 000000000000..afbf6a9a02c9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/AbstractOpenApiSchema.mustache @@ -0,0 +1,138 @@ +{{>licenseInfo}} + +package {{modelPackage}}; + +import {{invokerPackage}}.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; +import jakarta.ws.rs.core.GenericType; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}} +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + @JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).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 boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + +{{>libraries/jersey2/additional_properties}} + +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiClient.mustache new file mode 100644 index 000000000000..2454aafa8973 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiClient.mustache @@ -0,0 +1,1444 @@ +package {{invokerPackage}}; + +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.Form; +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +{{#hasOAuthMethods}} +import com.github.scribejava.core.model.OAuth2AccessToken; +{{/hasOAuthMethods}} +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.HttpUrlConnectorProvider; +import org.glassfish.jersey.jackson.JacksonFeature; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.MultiPart; +import org.glassfish.jersey.media.multipart.MultiPartFeature; + +import java.io.IOException; +import java.io.InputStream; + +import java.net.URI; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import java.security.cert.X509Certificate; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import org.glassfish.jersey.logging.LoggingFeature; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.Map.Entry; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Date; +{{#jsr310}} +import java.time.OffsetDateTime; +{{/jsr310}} + +import java.net.URLEncoder; + +import java.io.File; +import java.io.UnsupportedEncodingException; + +import java.text.DateFormat; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import {{invokerPackage}}.auth.Authentication; +import {{invokerPackage}}.auth.HttpBasicAuth; +import {{invokerPackage}}.auth.HttpBearerAuth; +{{#hasHttpSignatureMethods}} +import {{invokerPackage}}.auth.HttpSignatureAuth; +{{/hasHttpSignatureMethods}} +import {{invokerPackage}}.auth.ApiKeyAuth; +{{#hasOAuthMethods}} +import {{invokerPackage}}.auth.OAuth; +{{/hasOAuthMethods}} + +/** + *

ApiClient class.

+ */ +{{>generatedAnnotation}} +public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String basePath = "{{{basePath}}}"; + protected String userAgent; + private static final Logger log = Logger.getLogger(ApiClient.class.getName()); + + protected List servers = new ArrayList({{#servers}}{{#-first}}Arrays.asList( +{{/-first}} new ServerConfiguration( + "{{{url}}}", + "{{{description}}}{{^description}}No description provided{{/description}}", + new HashMap(){{#variables}}{{#-first}} {{ +{{/-first}} put("{{{name}}}", new ServerVariable( + "{{{description}}}{{^description}}No description provided{{/description}}", + "{{{defaultValue}}}", + new HashSet( + {{#enumValues}} + {{#-first}} + Arrays.asList( + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + ) + {{/-last}} + {{/enumValues}} + ) + )); + {{#-last}} + }}{{/-last}}{{/variables}} + ){{^-last}},{{/-last}} + {{#-last}} + ){{/-last}}{{/servers}}); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected Map> operationServers = new HashMap>() {{ + {{#apiInfo}} + {{#apis}} + {{#operations}} + {{#operation}} + {{#servers}} + {{#-first}} + put("{{{classname}}}.{{{operationId}}}", new ArrayList(Arrays.asList( + {{/-first}} + new ServerConfiguration( + "{{{url}}}", + "{{{description}}}{{^description}}No description provided{{/description}}", + new HashMap(){{#variables}}{{#-first}} {{ +{{/-first}} put("{{{name}}}", new ServerVariable( + "{{{description}}}{{^description}}No description provided{{/description}}", + "{{{defaultValue}}}", + new HashSet( + {{#enumValues}} + {{#-first}} + Arrays.asList( + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + ) + {{/-last}} + {{/enumValues}} + ) + )); + {{#-last}} + }}{{/-last}}{{/variables}} + ){{^-last}},{{/-last}} + {{#-last}} + )));{{/-last}} + {{/servers}} + {{/operation}} + {{/operations}} + {{/apis}} + {{/apiInfo}} + }}; + protected Map operationServerIndex = new HashMap(); + protected Map> operationServerVariables = new HashMap>(); + protected boolean debugging = false; + protected ClientConfig clientConfig; + protected int connectionTimeout = 0; + private int readTimeout = 0; + + protected Client httpClient; + protected JSON json; + protected String tempFolderPath = null; + + protected Map authentications; + protected Map authenticationLookup; + + protected DateFormat dateFormat; + + /** + * Constructs a new ApiClient with default parameters. + */ + public ApiClient() { + this(null); + } + + /** + * Constructs a new ApiClient with the specified authentication parameters. + * + * @param authMap A hash map containing authentication parameters. + */ + public ApiClient(Map authMap) { + json = new JSON(); + httpClient = buildHttpClient(); + + this.dateFormat = new RFC3339DateFormat(); + + // Set default User-Agent. + setUserAgent("{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap(); + Authentication auth = null; + {{#authMethods}} + if (authMap != null) { + auth = authMap.get("{{name}}"); + } + {{#isBasic}} + {{#isBasicBasic}} + if (auth instanceof HttpBasicAuth) { + authentications.put("{{name}}", auth); + } else { + authentications.put("{{name}}", new HttpBasicAuth()); + } + {{/isBasicBasic}} + {{#isBasicBearer}} + if (auth instanceof HttpBearerAuth) { + authentications.put("{{name}}", auth); + } else { + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}")); + } + {{/isBasicBearer}} + {{#isHttpSignature}} + if (auth instanceof HttpSignatureAuth) { + authentications.put("{{name}}", auth); + } + {{/isHttpSignature}} + {{/isBasic}} + {{#isApiKey}} + if (auth instanceof ApiKeyAuth) { + authentications.put("{{name}}", auth); + } else { + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}")); + } + {{/isApiKey}} + {{#isOAuth}} + if (auth instanceof OAuth) { + authentications.put("{{name}}", auth); + } else { + authentications.put("{{name}}", new OAuth(basePath, "{{tokenUrl}}")); + } + {{/isOAuth}} + {{/authMethods}} + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + + // Setup authentication lookup (key: authentication alias, value: authentication name) + authenticationLookup = new HashMap();{{#authMethods}}{{#vendorExtensions.x-auth-id-alias}} + authenticationLookup.put("{{name}}", "{{.}}");{{/vendorExtensions.x-auth-id-alias}}{{/authMethods}} + } + + /** + * Gets the JSON instance to do JSON serialization and deserialization. + * + * @return JSON + */ + public JSON getJSON() { + return json; + } + + /** + *

Getter for the field httpClient.

+ * + * @return a {@link jakarta.ws.rs.client.Client} object. + */ + public Client getHttpClient() { + return httpClient; + } + + /** + *

Setter for the field httpClient.

+ * + * @param httpClient a {@link jakarta.ws.rs.client.Client} object. + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setHttpClient(Client httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Returns the base URL to the location where the OpenAPI document is being served. + * + * @return The base URL to the target host. + */ + public String getBasePath() { + return basePath; + } + + /** + * Sets the base URL to the location where the OpenAPI document is being served. + * + * @param basePath The base URL to the target host. + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + {{#hasOAuthMethods}} + setOauthBasePath(basePath); + {{/hasOAuthMethods}} + return this; + } + + /** + *

Getter for the field servers.

+ * + * @return a {@link java.util.List} of servers. + */ + public List getServers() { + return servers; + } + + /** + *

Setter for the field servers.

+ * + * @param servers a {@link java.util.List} of servers. + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setServers(List servers) { + this.servers = servers; + updateBasePath(); + return this; + } + + /** + *

Getter for the field serverIndex.

+ * + * @return a {@link java.lang.Integer} object. + */ + public Integer getServerIndex() { + return serverIndex; + } + + /** + *

Setter for the field serverIndex.

+ * + * @param serverIndex the server index + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + updateBasePath(); + return this; + } + + /** + *

Getter for the field serverVariables.

+ * + * @return a {@link java.util.Map} of server variables. + */ + public Map getServerVariables() { + return serverVariables; + } + + /** + *

Setter for the field serverVariables.

+ * + * @param serverVariables a {@link java.util.Map} of server variables. + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + updateBasePath(); + return this; + } + + private void updateBasePath() { + if (serverIndex != null) { + setBasePath(servers.get(serverIndex).URL(serverVariables)); + } + } + + {{#hasOAuthMethods}} + private void setOauthBasePath(String basePath) { + for(Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setBasePath(basePath); + } + } + } + + {{/hasOAuthMethods}} + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication object + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return this; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return this; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return this; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to configure authentications which respects aliases of API keys. + * + * @param secrets Hash map from authentication name to its secret. + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient configureApiKeys(Map secrets) { + for (Map.Entry authEntry : authentications.entrySet()) { + Authentication auth = authEntry.getValue(); + if (auth instanceof ApiKeyAuth) { + String name = authEntry.getKey(); + // respect x-auth-id-alias property + name = authenticationLookup.containsKey(name) ? authenticationLookup.get(name) : name; + if (secrets.containsKey(name)) { + ((ApiKeyAuth) auth).setApiKey(secrets.get(name)); + } + } + } + return this; + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return this; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set bearer token for the first Bearer authentication. + * + * @param bearerToken Bearer token + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setBearerToken(String bearerToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(bearerToken); + return this; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + {{#hasOAuthMethods}} + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the credentials for the first OAuth2 authentication. + * + * @param clientId the client ID + * @param clientSecret the client secret + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setOauthCredentials(String clientId, String clientSecret) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setCredentials(clientId, clientSecret, isDebugging()); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the password flow for the first OAuth2 authentication. + * + * @param username the user name + * @param password the user password + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setOauthPasswordFlow(String username, String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).usePasswordFlow(username, password); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the authorization code flow for the first OAuth2 authentication. + * + * @param code the authorization code + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setOauthAuthorizationCodeFlow(String code) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).useAuthorizationCodeFlow(code); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the scopes for the first OAuth2 authentication. + * + * @param scope the oauth scope + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setOauthScope(String scope) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setScope(scope); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + {{/hasOAuthMethods}} + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent Http user agent + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setUserAgent(String userAgent) { + this.userAgent = userAgent; + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Get the User-Agent header's value. + * + * @return User-Agent string + */ + public String getUserAgent(){ + return userAgent; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Gets the client config. + * + * @return Client config + */ + public ClientConfig getClientConfig() { + return clientConfig; + } + + /** + * Set the client config. + * + * @param clientConfig Set the client config + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setClientConfig(ClientConfig clientConfig) { + this.clientConfig = clientConfig; + // Rebuild HTTP Client according to the new "clientConfig" value. + this.httpClient = buildHttpClient(); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is switched on + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setDebugging(boolean debugging) { + this.debugging = debugging; + // Rebuild HTTP Client according to the new "debugging" value. + this.httpClient = buildHttpClient(); + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @return Temp folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set temp folder path + * + * @param tempFolderPath Temp folder path + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Connect timeout (in milliseconds). + * + * @return Connection timeout + */ + public int getConnectTimeout() { + return connectionTimeout; + } + + /** + * Set the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param connectionTimeout Connection timeout in milliseconds + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + this.connectionTimeout = connectionTimeout; + httpClient.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout); + return this; + } + + /** + * read timeout (in milliseconds). + * + * @return Read timeout + */ + public int getReadTimeout() { + return readTimeout; + } + + /** + * Set the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param readTimeout Read timeout in milliseconds + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setReadTimeout(int readTimeout) { + this.readTimeout = readTimeout; + httpClient.property(ClientProperties.READ_TIMEOUT, readTimeout); + return this; + } + + /** + * Get the date format used to parse/format date parameters. + * + * @return Date format + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + * Set the date format used to parse/format date parameters. + * + * @param dateFormat Date format + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + // also set the date format for model (de)serialization with Date properties + this.json.setDateFormat((DateFormat) dateFormat.clone()); + return this; + } + + /** + * Parse the given string into Date object. + * + * @param str String + * @return Date + */ + public Date parseDate(String str) { + try { + return dateFormat.parse(str); + } catch (java.text.ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Format the given Date object into string. + * + * @param date Date + * @return Date in string format + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given parameter object into string. + * + * @param param Object + * @return Object in string format + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate((Date) param); + } {{#jsr310}}else if (param instanceof OffsetDateTime) { + return formatOffsetDateTime((OffsetDateTime) param); + } {{/jsr310}}else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for(Object o : (Collection)param) { + if(b.length() > 0) { + b.append(','); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /* + * Format to {@code Pair} objects. + * + * @param collectionFormat Collection format + * @param name Name + * @param value Value + * @return List of pairs + */ + public List parameterToPairs(String collectionFormat, String name, Object value){ + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null) return params; + + Collection valueCollection; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(new Pair(name, parameterToString(value))); + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + // get the collection format (default: csv) + String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); + + // create the params based on the collection format + if ("multi".equals(format)) { + for (Object item : valueCollection) { + params.add(new Pair(name, parameterToString(item))); + } + + return params; + } + + String delimiter = ","; + + if ("csv".equals(format)) { + delimiter = ","; + } else if ("ssv".equals(format)) { + delimiter = " "; + } else if ("tsv".equals(format)) { + delimiter = "\t"; + } else if ("pipes".equals(format)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : valueCollection) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + params.add(new Pair(name, sb.substring(1))); + + return params; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * + * @param mime MIME + * @return True if the MIME type is JSON + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Serialize the given Java object into string entity according the given + * Content-Type (only JSON is supported for now). + * + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @return Entity + * @throws ApiException API exception + */ + public Entity serialize(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { + Entity entity; + if (contentType.startsWith("multipart/form-data")) { + MultiPart multiPart = new MultiPart(); + for (Entry param: formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) + .fileName(file.getName()).size(file.length()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); + } else { + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); + } + } + entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + Form form = new Form(); + for (Entry param: formParams.entrySet()) { + form.param(param.getKey(), parameterToString(param.getValue())); + } + entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); + } else { + // We let jersey handle the serialization + if (isBodyNullable) { // payload is nullable + if (obj instanceof String) { + entity = Entity.entity(obj == null ? "null" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType); + } else { + entity = Entity.entity(obj == null ? "null" : obj, contentType); + } + } else { + if (obj instanceof String) { + entity = Entity.entity(obj == null ? "" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType); + } else { + entity = Entity.entity(obj == null ? "" : obj, contentType); + } + } + } + return entity; + } + + /** + * Serialize the given Java object into string according the given + * Content-Type (only JSON, HTTP form is supported for now). + * + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @param isBodyNullable True if the body is nullable + * @return String + * @throws ApiException API exception + */ + public String serializeToString(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { + try { + if (contentType.startsWith("multipart/form-data")) { + throw new ApiException("multipart/form-data not yet supported for serializeToString (http signature authentication)"); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + String formString = ""; + for (Entry param : formParams.entrySet()) { + formString = param.getKey() + "=" + URLEncoder.encode(parameterToString(param.getValue()), "UTF-8") + "&"; + } + + if (formString.length() == 0) { // empty string + return formString; + } else { + return formString.substring(0, formString.length() - 1); + } + } else { + if (isBodyNullable) { + return obj == null ? "null" : json.getMapper().writeValueAsString(obj); + } else { + return obj == null ? "" : json.getMapper().writeValueAsString(obj); + } + } + } catch (Exception ex) { + throw new ApiException("Failed to perform serializeToString: " + ex.toString()); + } + } + + /** + * Deserialize response body to Java object according to the Content-Type. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Deserialize object + * @throws ApiException API exception + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, GenericType returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + return (T) response.readEntity(byte[].class); + } else if (returnType.getRawType() == File.class) { + // Handle file downloading. + T file = (T) downloadFileFromResponse(response); + return file; + } + + String contentType = null; + List contentTypes = response.getHeaders().get("Content-Type"); + if (contentTypes != null && !contentTypes.isEmpty()) + contentType = String.valueOf(contentTypes.get(0)); + + // read the entity stream multiple times + response.bufferEntity(); + + return response.readEntity(returnType); + } + + /** + * Download file from the given response. + * + * @param response Response + * @return File + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + *

Prepare the file for download from the response.

+ * + * @param response a {@link jakarta.ws.rs.core.Response} object. + * @return a {@link java.io.File} object. + * @throws java.io.IOException if any. + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) + filename = matcher.group(1); + } + + String prefix; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf('.'); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param Type + * @param operation The qualified name of the operation + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE" + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param authNames The authentications to apply + * @param returnType The return type into which to deserialize the response + * @param isBodyNullable True if the body is nullable + * @return The response body in type of string + * @throws ApiException API exception + */ + public ApiResponse invokeAPI( + String operation, + String path, + String method, + List queryParams, + Object body, + Map headerParams, + Map cookieParams, + Map formParams, + String accept, + String contentType, + String[] authNames, + GenericType returnType, + boolean isBodyNullable) + throws ApiException { + + // Not using `.target(targetURL).path(path)` below, + // to support (constant) query string in `path`, e.g. "/posts?draft=1" + String targetURL; + if (serverIndex != null && operationServers.containsKey(operation)) { + Integer index = operationServerIndex.containsKey(operation) ? operationServerIndex.get(operation) : serverIndex; + Map variables = operationServerVariables.containsKey(operation) ? + operationServerVariables.get(operation) : serverVariables; + List serverConfigurations = operationServers.get(operation); + if (index < 0 || index >= serverConfigurations.size()) { + throw new ArrayIndexOutOfBoundsException( + String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", + index, serverConfigurations.size())); + } + targetURL = serverConfigurations.get(index).URL(variables) + path; + } else { + targetURL = this.basePath + path; + } + WebTarget target = httpClient.target(targetURL); + + if (queryParams != null) { + for (Pair queryParam : queryParams) { + if (queryParam.getValue() != null) { + target = target.queryParam(queryParam.getName(), escapeString(queryParam.getValue())); + } + } + } + + Invocation.Builder invocationBuilder; + if (accept != null) { + invocationBuilder = target.request().accept(accept); + } else { + invocationBuilder = target.request(); + } + + for (Entry entry : cookieParams.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); + } + } + + for (Entry entry : defaultCookieMap.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); + } + } + + Entity entity = serialize(body, formParams, contentType, isBodyNullable); + + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + serializeToString(body, formParams, contentType, isBodyNullable), + method, + target.getUri()); + + for (Entry entry : allHeaderParams.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.header(entry.getKey(), value); + } + } + + Response response = null; + + try { + response = sendRequest(method, invocationBuilder, entity); + + {{#hasOAuthMethods}} + // If OAuth is used and a status 401 is received, renew the access token and retry the request + if (response.getStatusInfo() == Status.UNAUTHORIZED) { + for (String authName : authNames) { + Authentication authentication = authentications.get(authName); + if (authentication instanceof OAuth) { + OAuth2AccessToken accessToken = ((OAuth) authentication).renewAccessToken(); + if (accessToken != null) { + invocationBuilder.header("Authorization", null); + invocationBuilder.header("Authorization", "Bearer " + accessToken.getAccessToken()); + response = sendRequest(method, invocationBuilder, entity); + } + break; + } + } + } + + {{/hasOAuthMethods}} + int statusCode = response.getStatusInfo().getStatusCode(); + Map> responseHeaders = buildResponseHeaders(response); + + if (response.getStatusInfo() == Status.NO_CONTENT) { + return new ApiResponse(statusCode, responseHeaders); + } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { + if (returnType == null) { + return new ApiResponse(statusCode, responseHeaders); + } else { + return new ApiResponse(statusCode, responseHeaders, deserialize(response, returnType)); + } + } else { + String message = "error"; + String respBody = null; + if (response.hasEntity()) { + try { + respBody = String.valueOf(response.readEntity(String.class)); + message = respBody; + } catch (RuntimeException e) { + // e.printStackTrace(); + } + } + throw new ApiException( + response.getStatus(), message, buildResponseHeaders(response), respBody); + } + } finally { + try { + response.close(); + } catch (Exception e) { + // it's not critical, since the response object is local in method invokeAPI; that's fine, + // just continue + } + } + } + + private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity entity) { + Response response; + if ("POST".equals(method)) { + response = invocationBuilder.post(entity); + } else if ("PUT".equals(method)) { + response = invocationBuilder.put(entity); + } else if ("DELETE".equals(method)) { + response = invocationBuilder.method("DELETE", entity); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.method("PATCH", entity); + } else { + response = invocationBuilder.method(method); + } + return response; + } + + /** + * @deprecated Add qualified name of the operation as a first parameter. + */ + @Deprecated + public ApiResponse invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType, boolean isBodyNullable) throws ApiException { + return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, isBodyNullable); + } + + /** + * Build the Client used to make HTTP requests. + * + * @return Client + */ + protected Client buildHttpClient() { + // recreate the client config to pickup changes + clientConfig = getDefaultClientConfig(); + + ClientBuilder clientBuilder = ClientBuilder.newBuilder(); + customizeClientBuilder(clientBuilder); + clientBuilder = clientBuilder.withConfig(clientConfig); + return clientBuilder.build(); + } + + /** + * Get the default client config. + * + * @return Client config + */ + public ClientConfig getDefaultClientConfig() { + ClientConfig clientConfig = new ClientConfig(); + clientConfig.register(MultiPartFeature.class); + clientConfig.register(json); + clientConfig.register(JacksonFeature.class); + clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); + // turn off compliance validation to be able to send payloads with DELETE calls + clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + if (debugging) { + clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); + clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); + // Set logger to ALL + java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME).setLevel(java.util.logging.Level.ALL); + } else { + // suppress warnings for payloads with DELETE calls: + java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); + } + + return clientConfig; + } + + /** + * Customize the client builder. + * + * This method can be overridden to customize the API client. For example, this can be used to: + * 1. Set the hostname verifier to be used by the client to verify the endpoint's hostname + * against its identification information. + * 2. Set the client-side key store. + * 3. Set the SSL context that will be used when creating secured transport connections to + * server endpoints from web targets created by the client instance that is using this SSL context. + * 4. Set the client-side trust store. + * + * To completely disable certificate validation (at your own risk), you can + * override this method and invoke disableCertificateValidation(clientBuilder). + * + * @param clientBuilder a {@link jakarta.ws.rs.client.ClientBuilder} object. + */ + protected void customizeClientBuilder(ClientBuilder clientBuilder) { + // No-op extension point + } + + /** + * Disable X.509 certificate validation in TLS connections. + * + * Please note that trusting all certificates is extremely risky. + * This may be useful in a development environment with self-signed certificates. + * + * @param clientBuilder a {@link jakarta.ws.rs.client.ClientBuilder} object. + * @throws java.security.KeyManagementException if any. + * @throws java.security.NoSuchAlgorithmException if any. + */ + protected void disableCertificateValidation(ClientBuilder clientBuilder) throws KeyManagementException, NoSuchAlgorithmException { + TrustManager[] trustAllCerts = new X509TrustManager[] { + new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) { + } + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) { + } + } + }; + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(null, trustAllCerts, new SecureRandom()); + clientBuilder.sslContext(sslContext); + } + + /** + *

Build the response headers.

+ * + * @param response a {@link jakarta.ws.rs.core.Response} object. + * @return a {@link java.util.Map} of response headers. + */ + protected Map> buildResponseHeaders(Response response) { + Map> responseHeaders = new HashMap>(); + for (Entry> entry: response.getHeaders().entrySet()) { + List values = entry.getValue(); + List headers = new ArrayList(); + for (Object o : values) { + headers.add(String.valueOf(o)); + } + responseHeaders.put(entry.getKey(), headers); + } + return responseHeaders; + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + * @param method HTTP method (e.g. POST) + * @param uri HTTP URI + */ + protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, + Map cookieParams, String payload, String method, URI uri) throws ApiException { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + continue; + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiResponse.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiResponse.mustache new file mode 100644 index 000000000000..86c889b0f67b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiResponse.mustache @@ -0,0 +1,73 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.util.List; +import java.util.Map; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +public class ApiResponse { + private final int statusCode; + private final Map> headers; + private final T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + {{#caseInsensitiveResponseHeaders}} + Map> responseHeaders = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : headers.entrySet()){ + responseHeaders.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.headers = {{#caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}; + this.data = data; + } + + /** + * Get the status code + * + * @return status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + * Get the headers + * + * @return map of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + * Get the data + * + * @return data + */ + public T getData() { + return data; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/JSON.mustache new file mode 100644 index 000000000000..aea0628ac378 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/JSON.mustache @@ -0,0 +1,261 @@ +package {{invokerPackage}}; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; +{{#openApiNullable}} +import org.openapitools.jackson.nullable.JsonNullableModule; +{{/openApiNullable}} +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +{{#joda}} +import com.fasterxml.jackson.datatype.joda.JodaModule; +{{/joda}} +{{#models.0}} +import {{modelPackage}}.*; +{{/models.0}} + +import java.text.DateFormat; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.ext.ContextResolver; + +{{>generatedAnnotation}} +public class JSON implements ContextResolver { + private ObjectMapper mapper; + + public JSON() { + mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.setDateFormat(new RFC3339DateFormat()); + mapper.registerModule(new JavaTimeModule()); + {{#joda}} + mapper.registerModule(new JodaModule()); + {{/joda}} + {{#openApiNullable}} + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + {{/openApiNullable}} + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + @Override + public ObjectMapper getContext(Class type) { + return mapper; + } + + /** + * Get the object mapper + * + * @return object mapper + */ + public ObjectMapper getMapper() { return mapper; } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asText(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (GenericType childType : descendants.values()) { + if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap, ClassDiscriminatorMapping>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map> modelDescendants = new HashMap, Map>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map descendants) { + modelDescendants.put(modelClass, descendants); + } + + private static JSON json; + + static + { + json = new JSON(); + } + + /** + * Get the default JSON instance. + * + * @return the default JSON instance + */ + public static JSON getDefault() { + return json; + } + + /** + * Set the default JSON instance. + * + * @param json JSON instance to be used + */ + public static void setDefault(JSON json) { + JSON.json = json; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/additional_properties.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/additional_properties.mustache new file mode 100644 index 000000000000..61973dc24fa1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/additional_properties.mustache @@ -0,0 +1,39 @@ +{{#additionalPropertiesType}} + /** + * 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. + */ + @JsonAnySetter + public {{classname}} putAdditionalProperty(String key, {{{.}}} value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public {{{.}}} getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } +{{/additionalPropertiesType}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/anyof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/anyof_model.mustache new file mode 100644 index 000000000000..2e14233bb93f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/anyof_model.mustache @@ -0,0 +1,202 @@ +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import {{invokerPackage}}.JSON; + +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} +@JsonDeserialize(using={{classname}}.{{classname}}Deserializer.class) +@JsonSerialize(using = {{classname}}.{{classname}}Serializer.class) +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { + private static final Logger log = Logger.getLogger({{classname}}.class.getName()); + + public static class {{classname}}Serializer extends StdSerializer<{{classname}}> { + public {{classname}}Serializer(Class<{{classname}}> t) { + super(t); + } + + public {{classname}}Serializer() { + this(null); + } + + @Override + public void serialize({{classname}} value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class {{classname}}Deserializer extends StdDeserializer<{{classname}}> { + public {{classname}}Deserializer() { + this({{classname}}.class); + } + + public {{classname}}Deserializer(Class vc) { + super(vc); + } + + @Override + public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + Object deserialized = null; + {{#discriminator}} + Class cls = JSON.getClassForElement(tree, {{classname}}.class); + if (cls != null) { + // When the OAS schema includes a discriminator, use the discriminator value to + // discriminate the anyOf schemas. + // Get the discriminator mapping value to get the class. + deserialized = tree.traverse(jp.getCodec()).readValueAs(cls); + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(deserialized); + return ret; + } + {{/discriminator}} + {{#anyOf}} + // deserialize {{{.}}} + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.class); + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match '{{classname}}'", e); + } + + {{/anyOf}} + throw new IOException(String.format("Failed deserialization for {{classname}}: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public {{classname}} getNullValue(DeserializationContext ctxt) throws JsonMappingException { + {{#isNullable}} + return null; + {{/isNullable}} + {{^isNullable}} + throw new JsonMappingException(ctxt.getParser(), "{{classname}} cannot be null"); + {{/isNullable}} + } + } + + // store a list of schema names defined in anyOf + public static final Map schemas = new HashMap(); + + public {{classname}}() { + super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + } +{{> libraries/jersey2/additional_properties }} + {{#additionalPropertiesType}} + /** + * Return true if this {{name}} object is equal to o. + */ + @Override + public boolean equals(Object o) { + return super.equals(o) && Objects.equals(this.additionalProperties, (({{classname}})o).additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); + } + {{/additionalPropertiesType}} + {{#anyOf}} + public {{classname}}({{{.}}} o) { + super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + setActualInstance(o); + } + + {{/anyOf}} + static { + {{#anyOf}} + schemas.put("{{{.}}}", new GenericType<{{{.}}}>() { + }); + {{/anyOf}} + JSON.registerDescendants({{classname}}.class, Collections.unmodifiableMap(schemas)); + {{#discriminator}} + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + {{#mappedModels}} + mappings.put("{{mappingName}}", {{modelName}}.class); + {{/mappedModels}} + mappings.put("{{name}}", {{classname}}.class); + JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings); + {{/discriminator}} + } + + @Override + public Map getSchemas() { + return {{classname}}.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}} + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + {{#isNullable}} + if (instance == null) { + super.setActualInstance(instance); + return; + } + + {{/isNullable}} + {{#anyOf}} + if (JSON.isInstanceOf({{{.}}}.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + {{/anyOf}} + throw new RuntimeException("Invalid instance type. Must be {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}"); + } + + /** + * Get the actual instance, which can be the following: + * {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}} + * + * @return The actual instance ({{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + {{#anyOf}} + /** + * Get the actual instance of `{{{.}}}`. If the actual instance is not `{{{.}}}`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `{{{.}}}` + * @throws ClassCastException if the instance is not `{{{.}}}` + */ + public {{{.}}} get{{{.}}}() throws ClassCastException { + return ({{{.}}})super.getActualInstance(); + } + + {{/anyOf}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api.mustache new file mode 100644 index 000000000000..16cd00688679 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api.mustache @@ -0,0 +1,262 @@ +package {{package}}; + +import {{invokerPackage}}.ApiException; +import {{invokerPackage}}.ApiClient; +import {{invokerPackage}}.ApiResponse; +import {{invokerPackage}}.Configuration; +import {{invokerPackage}}.Pair; + +import jakarta.ws.rs.core.GenericType; + +{{#imports}}import {{import}}; +{{/imports}} + +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +{{/fullJavaUtil}} +{{>generatedAnnotation}} +{{#operations}} +public class {{classname}} { + private ApiClient apiClient; + + public {{classname}}() { + this(Configuration.getDefaultApiClient()); + } + + public {{classname}}(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + {{#operation}} + {{^vendorExtensions.x-group-parameters}} + /** + * {{summary}} + * {{notes}} + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + {{/allParams}} + {{#returnType}} + * @return {{.}} + {{/returnType}} + * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}return {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}}.getData(){{/returnType}}; + } + {{/vendorExtensions.x-group-parameters}} + + {{^vendorExtensions.x-group-parameters}} + /** + * {{summary}} + * {{notes}} + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + {{/allParams}} + * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + {{#allParams}}{{#required}} + // verify the required parameter '{{paramName}}' is set + if ({{paramName}} == null) { + throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}"); + } + {{/required}}{{/allParams}} + // create path and map variables + String localVarPath = "{{{path}}}"{{#pathParams}} + .replaceAll("\\{" + "{{baseName}}" + "\\}", apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}}; + + // query params + {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); + {{javaUtilPrefix}}Map localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); + {{javaUtilPrefix}}Map localVarCookieParams = new {{javaUtilPrefix}}HashMap(); + {{javaUtilPrefix}}Map localVarFormParams = new {{javaUtilPrefix}}HashMap(); + + {{#queryParams}} + localVarQueryParams.addAll(apiClient.parameterToPairs("{{{collectionFormat}}}", "{{baseName}}", {{paramName}})); + {{/queryParams}} + + {{#headerParams}}if ({{paramName}} != null) + localVarHeaderParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); + {{/headerParams}} + + {{#cookieParams}}if ({{paramName}} != null) + localVarCookieParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); + {{/cookieParams}} + + {{#formParams}}if ({{paramName}} != null) + localVarFormParams.put("{{baseName}}", {{paramName}}); + {{/formParams}} + + final String[] localVarAccepts = { + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + + {{#returnType}} + GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; + + {{/returnType}} + return apiClient.invokeAPI("{{classname}}.{{operationId}}", localVarPath, "{{httpMethod}}", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}, {{#bodyParam}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/bodyParam}}{{^bodyParam}}false{{/bodyParam}}); + } + {{#vendorExtensions.x-group-parameters}} + + public class API{{operationId}}Request { + {{#allParams}} + private {{#isRequired}}final {{/isRequired}}{{{dataType}}} {{paramName}}; + {{/allParams}} + + private API{{operationId}}Request({{#pathParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) { + {{#pathParams}} + this.{{paramName}} = {{paramName}}; + {{/pathParams}} + } + {{#allParams}} + {{^isPathParam}} + + /** + * Set {{paramName}} + * @param {{paramName}} {{description}} ({{^required}}optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}{{/required}}{{#required}}required{{/required}}) + * @return API{{operationId}}Request + */ + public API{{operationId}}Request {{paramName}}({{{dataType}}} {{paramName}}) { + this.{{paramName}} = {{paramName}}; + return this; + } + {{/isPathParam}} + {{/allParams}} + + /** + * Execute {{operationId}} request + {{#returnType}}* @return {{.}}{{/returnType}} + * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}}* @deprecated{{/isDeprecated}} + */ + {{#isDeprecated}}@Deprecated{{/isDeprecated}} + public {{{returnType}}}{{^returnType}}void{{/returnType}} execute() throws ApiException { + {{#returnType}}return {{/returnType}}this.executeWithHttpInfo().getData(); + } + + /** + * Execute {{operationId}} request with HTTP info returned + * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated{{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + } + + /** + * {{summary}} + * {{notes}}{{#pathParams}} + * @param {{paramName}} {{description}} (required){{/pathParams}} + * @return {{operationId}}Request + * @throws ApiException if fails to make API call + {{#isDeprecated}}* @deprecated{{/isDeprecated}} + {{#externalDocs}}* {{description}} + * @see {{summary}} Documentation{{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public API{{operationId}}Request {{operationId}}({{#pathParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) throws ApiException { + return new API{{operationId}}Request({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}); + } + {{/vendorExtensions.x-group-parameters}} + {{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/apiException.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/apiException.mustache new file mode 100644 index 000000000000..74a419aacf16 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/apiException.mustache @@ -0,0 +1,99 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.util.Map; +import java.util.List; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} + +/** + * API Exception + */ +{{>generatedAnnotation}} +public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + {{#caseInsensitiveResponseHeaders}} + Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + {{#caseInsensitiveResponseHeaders}} + Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api_doc.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api_doc.mustache new file mode 100644 index 000000000000..26c98508ea1d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api_doc.mustache @@ -0,0 +1,124 @@ +# {{classname}}{{#description}} + +{{.}}{{/description}} + +All URIs are relative to *{{basePath}}* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} + +## {{operationId}} + +{{^vendorExtensions.x-group-parameters}} +> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) +{{/vendorExtensions.x-group-parameters}} +{{#vendorExtensions.x-group-parameters}} +> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}.execute(); +{{/vendorExtensions.x-group-parameters}} + +{{summary}}{{#notes}} + +{{{unescapedNotes}}}{{/notes}} + +### Example + +```java +{{#vendorExtensions.x-java-import}} +import {{.}}; +{{/vendorExtensions.x-java-import}} +// Import classes: +import {{{invokerPackage}}}.ApiClient; +import {{{invokerPackage}}}.ApiException; +import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} +import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} +import {{{invokerPackage}}}.model.*; +import {{{package}}}.{{{classname}}}; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("{{{basePath}}}"); + {{#hasAuthMethods}} + {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + // Configure HTTP basic authorization: {{{name}}} + HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setUsername("YOUR USERNAME"); + {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} + // Configure HTTP bearer authorization: {{{name}}} + HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} + {{/authMethods}} + {{/hasAuthMethods}} + + {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); + {{#allParams}} + {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} + {{/allParams}} + try { + {{^vendorExtensions.x-group-parameters}} + {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}); + {{/vendorExtensions.x-group-parameters}} + {{#vendorExtensions.x-group-parameters}} + {{#returnType}}{{{.}}} result = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}} + .{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}} + .execute(); + {{/vendorExtensions.x-group-parameters}} + {{#returnType}} + System.out.println(result); + {{/returnType}} + } catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------|{{/-last}}{{/allParams}} +{{#allParams}}| **{{paramName}}** | {{#isContainer}}{{#isArray}}{{#items}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**List<{{dataType}}>**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/items}}{{/isArray}}{{#isMap}}{{#items}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**Map<String,{{dataType}}>**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/items}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**{{dataType}}**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/isContainer}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + +- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} +- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} + +{{#responses.0}} +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +{{#responses}} +| **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}} | +{{/responses}} +{{/responses.0}} + +{{/operation}} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api_test.mustache new file mode 100644 index 000000000000..eb5101b1a602 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api_test.mustache @@ -0,0 +1,59 @@ +{{>licenseInfo}} + +package {{package}}; + +import {{invokerPackage}}.*; +import {{invokerPackage}}.auth.*; +{{#imports}}import {{import}}; +{{/imports}} + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +{{/fullJavaUtil}} +/** + * API tests for {{classname}} + */ +public class {{classname}}Test { + + private final {{classname}} api = new {{classname}}(); + + {{#operations}} + {{#operation}} + /** + {{#summary}} + * {{summary}} + * + {{/summary}} + {{#notes}} + * {{notes}} + * + {{/notes}} + * @throws ApiException if the Api call fails + */ + @Test + public void {{operationId}}Test() throws ApiException { + {{#allParams}} + //{{{dataType}}} {{paramName}} = null; + {{/allParams}} + {{^vendorExtensions.x-group-parameters}} + //{{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + {{/vendorExtensions.x-group-parameters}} + {{#vendorExtensions.x-group-parameters}} + //{{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}} + // .{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}} + // .execute(); + {{/vendorExtensions.x-group-parameters}} + // TODO: test validations + } + + {{/operation}} + {{/operations}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/ApiKeyAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/ApiKeyAuth.mustache new file mode 100644 index 000000000000..1731f936fb87 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/ApiKeyAuth.mustache @@ -0,0 +1,68 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +{{>generatedAnnotation}} +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/Authentication.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/Authentication.mustache new file mode 100644 index 000000000000..46d9c1ab6ace --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/Authentication.mustache @@ -0,0 +1,22 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; + +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpBasicAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpBasicAuth.mustache new file mode 100644 index 000000000000..13cecfa90a73 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpBasicAuth.mustache @@ -0,0 +1,44 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.util.Base64; +import java.nio.charset.StandardCharsets; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +{{>generatedAnnotation}} +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + if (username == null && password == null) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpBearerAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpBearerAuth.mustache new file mode 100644 index 000000000000..110a11ea7798 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpBearerAuth.mustache @@ -0,0 +1,51 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +{{>generatedAnnotation}} +public class HttpBearerAuth implements Authentication { + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return bearerToken; + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + if(bearerToken == null) { + return; + } + + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpSignatureAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpSignatureAuth.mustache new file mode 100644 index 000000000000..ac0a77db8acf --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpSignatureAuth.mustache @@ -0,0 +1,269 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.net.URI; +import java.net.URLEncoder; +import java.security.MessageDigest; +import java.security.Key; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.List; +import java.util.TimeZone; +import java.security.spec.AlgorithmParameterSpec; +import java.security.InvalidKeyException; + +import org.tomitribe.auth.signatures.Algorithm; +import org.tomitribe.auth.signatures.Signer; +import org.tomitribe.auth.signatures.Signature; +import org.tomitribe.auth.signatures.SigningAlgorithm; + +/** + * A Configuration object for the HTTP message signature security scheme. + */ +public class HttpSignatureAuth implements Authentication { + + private Signer signer; + + // An opaque string that the server can use to look up the component they need to validate the signature. + private String keyId; + + // The HTTP signature algorithm. + private SigningAlgorithm signingAlgorithm; + + // The HTTP cryptographic algorithm. + private Algorithm algorithm; + + // The cryptographic parameters. + private AlgorithmParameterSpec parameterSpec; + + // The list of HTTP headers that should be included in the HTTP signature. + private List headers; + + // The digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + private String digestAlgorithm; + + // The maximum validity duration of the HTTP signature. + private Long maxSignatureValidity; + + /** + * Construct a new HTTP signature auth configuration object. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + * @param signingAlgorithm The signature algorithm. + * @param algorithm The cryptographic algorithm. + * @param digestAlgorithm The digest algorithm. + * @param headers The list of HTTP headers that should be included in the HTTP signature. + * @param maxSignatureValidity The maximum validity duration of the HTTP signature. + * Used to set the '(expires)' field in the HTTP signature. + */ + public HttpSignatureAuth(String keyId, + SigningAlgorithm signingAlgorithm, + Algorithm algorithm, + String digestAlgorithm, + AlgorithmParameterSpec parameterSpec, + List headers, + Long maxSignatureValidity) { + this.keyId = keyId; + this.signingAlgorithm = signingAlgorithm; + this.algorithm = algorithm; + this.parameterSpec = parameterSpec; + this.digestAlgorithm = digestAlgorithm; + this.headers = headers; + this.maxSignatureValidity = maxSignatureValidity; + } + + /** + * Returns the opaque string that the server can use to look up the component they need to validate the signature. + * + * @return The keyId. + */ + public String getKeyId() { + return keyId; + } + + /** + * Set the HTTP signature key id. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + */ + public void setKeyId(String keyId) { + this.keyId = keyId; + } + + /** + * Returns the HTTP signature algorithm which is used to sign HTTP requests. + */ + public SigningAlgorithm getSigningAlgorithm() { + return signingAlgorithm; + } + + /** + * Sets the HTTP signature algorithm which is used to sign HTTP requests. + * + * @param signingAlgorithm The HTTP signature algorithm. + */ + public void setSigningAlgorithm(SigningAlgorithm signingAlgorithm) { + this.signingAlgorithm = signingAlgorithm; + } + + /** + * Returns the HTTP cryptographic algorithm which is used to sign HTTP requests. + */ + public Algorithm getAlgorithm() { + return algorithm; + } + + /** + * Sets the HTTP cryptographic algorithm which is used to sign HTTP requests. + * + * @param algorithm The HTTP signature algorithm. + */ + public void setAlgorithm(Algorithm algorithm) { + this.algorithm = algorithm; + } + + /** + * Returns the cryptographic parameters which are used to sign HTTP requests. + */ + public AlgorithmParameterSpec getAlgorithmParameterSpec() { + return parameterSpec; + } + + /** + * Sets the cryptographic parameters which are used to sign HTTP requests. + * + * @param parameterSpec The cryptographic parameters. + */ + public void setAlgorithmParameterSpec(AlgorithmParameterSpec parameterSpec) { + this.parameterSpec = parameterSpec; + } + + /** + * Returns the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * @see java.security.MessageDigest + */ + public String getDigestAlgorithm() { + return digestAlgorithm; + } + + /** + * Sets the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * The exact list of supported digest algorithms depends on the installed security providers. + * Every implementation of the Java platform is required to support "MD5", "SHA-1" and "SHA-256". + * Do not use "MD5" and "SHA-1", they are vulnerable to multiple known attacks. + * By default, "SHA-256" is used. + * + * @param digestAlgorithm The digest algorithm. + * + * @see java.security.MessageDigest + */ + public void setDigestAlgorithm(String digestAlgorithm) { + this.digestAlgorithm = digestAlgorithm; + } + + /** + * Returns the list of HTTP headers that should be included in the HTTP signature. + */ + public List getHeaders() { + return headers; + } + + /** + * Sets the list of HTTP headers that should be included in the HTTP signature. + * + * @param headers The HTTP headers. + */ + public void setHeaders(List headers) { + this.headers = headers; + } + + /** + * Returns the maximum validity duration of the HTTP signature. + * @return The maximum validity duration of the HTTP signature. + */ + public Long getMaxSignatureValidity() { + return maxSignatureValidity; + } + + /** + * Returns the signer instance used to sign HTTP messages. + * + * @return the signer instance. + */ + public Signer getSigner() { + return signer; + } + + /** + * Sets the signer instance used to sign HTTP messages. + * + * @param signer The signer instance to set. + */ + public void setSigner(Signer signer) { + this.signer = signer; + } + + /** + * Set the private key used to sign HTTP requests using the HTTP signature scheme. + * + * @param key The private key. + * + * @throws InvalidKeyException Unable to parse the key, or the security provider for this key + * is not installed. + */ + public void setPrivateKey(Key key) throws InvalidKeyException, ApiException { + if (key == null) { + throw new ApiException("Private key (java.security.Key) cannot be null"); + } + signer = new Signer(key, new Signature(keyId, signingAlgorithm, algorithm, parameterSpec, null, headers, maxSignatureValidity)); + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + try { + if (headers.contains("host")) { + headerParams.put("host", uri.getHost()); + } + + if (headers.contains("date")) { + SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); + dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); + headerParams.put("date", dateFormat.format(Calendar.getInstance().getTime())); + } + + if (headers.contains("digest")) { + headerParams.put("digest", + this.digestAlgorithm + "=" + + new String(Base64.getEncoder().encode(MessageDigest.getInstance(this.digestAlgorithm).digest(payload.getBytes())))); + } + + if (signer == null) { + throw new ApiException("Signer cannot be null. Please call the method `setPrivateKey` to set it up correctly"); + } + + // construct the path with the URL-encoded path and query. + // Calling getRawPath and getRawQuery ensures the path is URL-encoded as it will be serialized + // on the wire. The HTTP signature must use the encode URL as it is sent on the wire. + String path = uri.getRawPath(); + if (uri.getRawQuery() != null && !"".equals(uri.getRawQuery())) { + path += "?" + uri.getRawQuery(); + } + + headerParams.put("Authorization", signer.sign(method, path, headerParams).toString()); + } catch (Exception ex) { + throw new ApiException("Failed to create signature in the HTTP request header: " + ex.toString()); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/OAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/OAuth.mustache new file mode 100644 index 000000000000..73d6d19dbdbd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/OAuth.mustache @@ -0,0 +1,182 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.exceptions.OAuthException; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.oauth.OAuth20Service; + +import jakarta.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.logging.Level; +import java.util.logging.Logger; + +{{>generatedAnnotation}} +public class OAuth implements Authentication { + private static final Logger log = Logger.getLogger(OAuth.class.getName()); + + private String tokenUrl; + private String absoluteTokenUrl; + private OAuthFlow flow = OAuthFlow.APPLICATION; + private OAuth20Service service; + private DefaultApi20 authApi; + private String scope; + private String username; + private String password; + private String code; + private volatile OAuth2AccessToken accessToken; + + public OAuth(String basePath, String tokenUrl) { + this.tokenUrl = tokenUrl; + this.absoluteTokenUrl = createAbsoluteTokenUrl(basePath, tokenUrl); + authApi = new DefaultApi20() { + @Override + public String getAccessTokenEndpoint() { + return absoluteTokenUrl; + } + + @Override + protected String getAuthorizationBaseUrl() { + throw new UnsupportedOperationException("Shouldn't get there !"); + } + }; + } + + private static String createAbsoluteTokenUrl(String basePath, String tokenUrl) { + if (!URI.create(tokenUrl).isAbsolute()) { + try { + return UriBuilder.fromPath(basePath).path(tokenUrl).build().toURL().toString(); + } catch (MalformedURLException e) { + log.log(Level.SEVERE, "Couldn't create absolute token URL", e); + } + } + return tokenUrl; + } + + @Override + public void applyToParams( + List queryParams, + Map headerParams, + Map cookieParams, + String payload, + String method, + URI uri) + throws ApiException { + + if (accessToken == null) { + obtainAccessToken(null); + } + if (accessToken != null) { + headerParams.put("Authorization", "Bearer " + accessToken.getAccessToken()); + } + } + + public OAuth2AccessToken renewAccessToken() throws ApiException { + String refreshToken = null; + if (accessToken != null) { + refreshToken = accessToken.getRefreshToken(); + accessToken = null; + } + return obtainAccessToken(refreshToken); + } + + public synchronized OAuth2AccessToken obtainAccessToken(String refreshToken) throws ApiException { + if (service == null) { + log.log(Level.FINE, "service is null in obtainAccessToken."); + return null; + } + try { + if (refreshToken != null) { + return service.refreshAccessToken(refreshToken); + } + } catch (OAuthException | InterruptedException | ExecutionException | IOException e) { + log.log(Level.FINE, "Refreshing the access token using the refresh token failed", e); + } + try { + switch (flow) { + case PASSWORD: + if (username != null && password != null) { + accessToken = service.getAccessTokenPasswordGrant(username, password, scope); + } + break; + case ACCESS_CODE: + if (code != null) { + accessToken = service.getAccessToken(code); + code = null; + } + break; + case APPLICATION: + accessToken = service.getAccessTokenClientCredentialsGrant(scope); + break; + default: + log.log(Level.SEVERE, "Invalid flow in obtainAccessToken: " + flow); + } + } catch (OAuthException | InterruptedException | ExecutionException | IOException e) { + throw new ApiException(e); + } + return accessToken; + } + + public OAuth2AccessToken getAccessToken() { + return accessToken; + } + + public OAuth setAccessToken(OAuth2AccessToken accessToken) { + this.accessToken = accessToken; + return this; + } + + public OAuth setAccessToken(String accessToken) { + this.accessToken = new OAuth2AccessToken(accessToken); + return this; + } + + public OAuth setScope(String scope) { + this.scope = scope; + return this; + } + + public OAuth setCredentials(String clientId, String clientSecret, Boolean debug) { + if (Boolean.TRUE.equals(debug)) { + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret).debug() + .build(authApi); + } else { + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .build(authApi); + } + return this; + } + + public OAuth usePasswordFlow(String username, String password) { + this.flow = OAuthFlow.PASSWORD; + this.username = username; + this.password = password; + return this; + } + + public OAuth useAuthorizationCodeFlow(String code) { + this.flow = OAuthFlow.ACCESS_CODE; + this.code = code; + return this; + } + + public OAuth setFlow(OAuthFlow flow) { + this.flow = flow; + return this; + } + + public void setBasePath(String basePath) { + this.absoluteTokenUrl = createAbsoluteTokenUrl(basePath, tokenUrl); + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/OAuthFlow.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/OAuthFlow.mustache new file mode 100644 index 000000000000..190781fb1264 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/OAuthFlow.mustache @@ -0,0 +1,13 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +/** + * OAuth flows that are supported by this client + */ +public enum OAuthFlow { + ACCESS_CODE, + IMPLICIT, + PASSWORD, + APPLICATION +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.gradle.mustache new file mode 100644 index 000000000000..5ebc725c4f37 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.gradle.mustache @@ -0,0 +1,177 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'com.diffplug.spotless' + +group = '{{groupId}}' +version = '{{artifactVersion}}' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.3.0' + } +} + +repositories { + mavenCentral() +} + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven-publish' + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + + from components.java + } + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + swagger_annotations_version = "1.6.5" + jackson_version = "2.13.2" + jackson_databind_version = "2.13.2" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.2" + {{/openApiNullable}} + jakarta_annotation_version = "2.1.0" + jersey_version = "3.0.4" + junit_version = "5.8.2" + {{#hasOAuthMethods}} + scribejava_apis_version = "8.3.1" + {{/hasOAuthMethods}} + {{#hasHttpSignatureMethods}} + tomitribe_http_signatures_version = "1.7" + {{/hasHttpSignatureMethods}} +} + +dependencies { + implementation "io.swagger:swagger-annotations:$swagger_annotations_version" + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "org.glassfish.jersey.core:jersey-client:$jersey_version" + implementation "org.glassfish.jersey.inject:jersey-hk2:$jersey_version" + implementation "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version" + implementation "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" + implementation "org.glassfish.jersey.connectors:jersey-apache-connector:$jersey_version" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" + {{#openApiNullable}} + implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + {{/openApiNullable}} + {{#joda}} + implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" + {{/joda}} + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + {{#hasOAuthMethods}} + implementation "com.github.scribejava:scribejava-apis:$scribejava_apis_version" + {{/hasOAuthMethods}} + {{#hasHttpSignatureMethods}} + implementation "org.tomitribe:tomitribe-http-signatures:$tomitribe_http_signatures_version" + {{/hasHttpSignatureMethods}} + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +} + +test { + useJUnitPlatform() +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + java { + // don't need to set target, it is inferred from java + // apply a specific flavor of google-java-format + googleJavaFormat('1.8').aosp().reflowLongStrings() + removeUnusedImports() + importOrder() + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.sbt.mustache new file mode 100644 index 000000000000..aef4fc30d162 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.sbt.mustache @@ -0,0 +1,38 @@ +lazy val root = (project in file(".")). + settings( + organization := "{{groupId}}", + name := "{{artifactId}}", + version := "{{artifactVersion}}", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + Compile / javacOptions ++= Seq("-Xlint:deprecation"), + Compile / packageDoc / publishArtifact := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "com.google.code.findbugs" % "jsr305" % "3.0.0", + "io.swagger" % "swagger-annotations" % "1.6.5", + "org.glassfish.jersey.core" % "jersey-client" % "3.0.4", + "org.glassfish.jersey.inject" % "jersey-hk2" % "3.0.4", + "org.glassfish.jersey.media" % "jersey-media-multipart" % "3.0.4", + "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "3.0.4", + "org.glassfish.jersey.connectors" % "jersey-apache-connector" % "3.0.4", + "com.fasterxml.jackson.core" % "jackson-core" % "2.13.2" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.2" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2" % "compile", + {{#joda}} + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.13.0" % "compile", + {{/joda}} + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", + {{#openApiNullable}} + "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", + {{/openApiNullable}} + {{#hasOAuthMethods}} + "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", + {{/hasOAuthMethods}} + {{#hasHttpSignatureMethods}} + "org.tomitribe" % "tomitribe-http-signatures" % "1.7" % "compile", + {{/hasHttpSignatureMethods}} + "jakarta.annotation" % "jakarta.annotation-api" % "2.1.0" % "compile", + "org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test" + ) + ) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/generatedAnnotation.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/generatedAnnotation.mustache new file mode 100644 index 000000000000..e4f87495451d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/generatedAnnotation.mustache @@ -0,0 +1 @@ +@jakarta.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}}) \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model.mustache new file mode 100644 index 000000000000..914e1eb1e29a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model.mustache @@ -0,0 +1,64 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#useReflectionEqualsHashCode}} +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +{{/useReflectionEqualsHashCode}} +{{#models}} +{{#model}} +{{#additionalPropertiesType}} +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +{{/additionalPropertiesType}} +{{/model}} +{{/models}} +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +{{#imports}} +import {{import}}; +{{/imports}} +{{#serializableModel}} +import java.io.Serializable; +{{/serializableModel}} +{{#jackson}} +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +{{#withXml}} +import com.fasterxml.jackson.dataformat.xml.annotation.*; +{{/withXml}} +{{#vendorExtensions.x-has-readonly-properties}} +import com.fasterxml.jackson.annotation.JsonCreator; +{{/vendorExtensions.x-has-readonly-properties}} +{{/jackson}} +{{#withXml}} +import javax.xml.bind.annotation.*; +{{/withXml}} +{{#parcelableModel}} +import android.os.Parcelable; +import android.os.Parcel; +{{/parcelableModel}} +{{#useBeanValidation}} +import javax.validation.constraints.*; +import javax.validation.Valid; +{{/useBeanValidation}} +{{#performBeanValidation}} +import org.hibernate.validator.constraints.*; +{{/performBeanValidation}} +import {{invokerPackage}}.JSON; + +{{#models}} +{{#model}} +{{#oneOf}} +{{#-first}} +import com.fasterxml.jackson.core.type.TypeReference; +{{/-first}} +{{/oneOf}} + +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#oneOf}}{{#-first}}{{>oneof_model}}{{/-first}}{{/oneOf}}{{^oneOf}}{{#anyOf}}{{#-first}}{{>anyof_model}}{{/-first}}{{/anyOf}}{{^anyOf}}{{>pojo}}{{/anyOf}}{{/oneOf}}{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_anyof_doc.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_anyof_doc.mustache new file mode 100644 index 000000000000..e360aa56e6c3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_anyof_doc.mustache @@ -0,0 +1,38 @@ +# {{classname}} + +{{#description}} +{{&description}} + +{{/description}} +## anyOf schemas +{{#anyOf}} +* [{{{.}}}]({{{.}}}.md) +{{/anyOf}} + +{{#isNullable}} +NOTE: this class is nullable. + +{{/isNullable}} +## Example +```java +// Import classes: +import {{{package}}}.{{{classname}}}; +{{#anyOf}} +import {{{package}}}.{{{.}}}; +{{/anyOf}} + +public class Example { + public static void main(String[] args) { + {{classname}} example{{classname}} = new {{classname}}(); + {{#anyOf}} + + // create a new {{{.}}} + {{{.}}} example{{{.}}} = new {{{.}}}(); + // set {{{classname}}} to {{{.}}} + example{{classname}}.setActualInstance(example{{{.}}}); + // to get back the {{{.}}} set earlier + {{{.}}} test{{{.}}} = ({{{.}}}) example{{classname}}.getActualInstance(); + {{/anyOf}} + } +} +``` diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_doc.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_doc.mustache new file mode 100644 index 000000000000..be1aedcf2f31 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_doc.mustache @@ -0,0 +1,19 @@ +{{#models}}{{#model}} + +{{#isEnum}} +{{>enum_outer_doc}} +{{/isEnum}} +{{^isEnum}} +{{^oneOf.isEmpty}} +{{>model_oneof_doc}} +{{/oneOf.isEmpty}} +{{^anyOf.isEmpty}} +{{>model_anyof_doc}} +{{/anyOf.isEmpty}} +{{^anyOf}} +{{^oneOf}} +{{>pojo_doc}} +{{/oneOf}} +{{/anyOf}} +{{/isEnum}} +{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_oneof_doc.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_oneof_doc.mustache new file mode 100644 index 000000000000..5fff76c9efa0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_oneof_doc.mustache @@ -0,0 +1,38 @@ +# {{classname}} + +{{#description}} +{{&description}} + +{{/description}} +## oneOf schemas +{{#oneOf}} +* [{{{.}}}]({{{.}}}.md) +{{/oneOf}} + +{{#isNullable}} +NOTE: this class is nullable. + +{{/isNullable}} +## Example +```java +// Import classes: +import {{{package}}}.{{{classname}}}; +{{#oneOf}} +import {{{package}}}.{{{.}}}; +{{/oneOf}} + +public class Example { + public static void main(String[] args) { + {{classname}} example{{classname}} = new {{classname}}(); + {{#oneOf}} + + // create a new {{{.}}} + {{{.}}} example{{{.}}} = new {{{.}}}(); + // set {{{classname}}} to {{{.}}} + example{{classname}}.setActualInstance(example{{{.}}}); + // to get back the {{{.}}} set earlier + {{{.}}} test{{{.}}} = ({{{.}}}) example{{classname}}.getActualInstance(); + {{/oneOf}} + } +} +``` diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_test.mustache new file mode 100644 index 000000000000..2d4ccdd1a14f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_test.mustache @@ -0,0 +1,51 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +{{#fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +{{/fullJavaUtil}} +/** + * Model tests for {{classname}} + */ +public class {{classname}}Test { + {{#models}} + {{#model}} + {{^vendorExtensions.x-is-one-of-interface}} + {{^isEnum}} + private final {{classname}} model = new {{classname}}(); + + {{/isEnum}} + /** + * Model tests for {{classname}} + */ + @Test + public void test{{classname}}() { + // TODO: test {{classname}} + } + + {{#allVars}} + /** + * Test the property '{{name}}' + */ + @Test + public void {{name}}Test() { + // TODO: test {{name}} + } + + {{/allVars}} + {{/vendorExtensions.x-is-one-of-interface}} + {{/model}} + {{/models}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/oneof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/oneof_model.mustache new file mode 100644 index 000000000000..e592998299a4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/oneof_model.mustache @@ -0,0 +1,235 @@ +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import {{invokerPackage}}.JSON; + +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} +@JsonDeserialize(using = {{classname}}.{{classname}}Deserializer.class) +@JsonSerialize(using = {{classname}}.{{classname}}Serializer.class) +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { + private static final Logger log = Logger.getLogger({{classname}}.class.getName()); + + public static class {{classname}}Serializer extends StdSerializer<{{classname}}> { + public {{classname}}Serializer(Class<{{classname}}> t) { + super(t); + } + + public {{classname}}Serializer() { + this(null); + } + + @Override + public void serialize({{classname}} value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class {{classname}}Deserializer extends StdDeserializer<{{classname}}> { + public {{classname}}Deserializer() { + this({{classname}}.class); + } + + public {{classname}}Deserializer(Class vc) { + super(vc); + } + + @Override + public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + {{#useOneOfDiscriminatorLookup}} + {{#discriminator}} + {{classname}} new{{classname}} = new {{classname}}(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("{{{propertyBaseName}}}"); + switch (discriminatorValue) { + {{#mappedModels}} + case "{{{mappingName}}}": + deserialized = tree.traverse(jp.getCodec()).readValueAs({{{modelName}}}.class); + new{{classname}}.setActualInstance(deserialized); + return new{{classname}}; + {{/mappedModels}} + default: + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue)); + } + + {{/discriminator}} + {{/useOneOfDiscriminatorLookup}} + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + {{#oneOf}} + // deserialize {{{.}}} + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if ({{{.}}}.class.equals(Integer.class) || {{{.}}}.class.equals(Long.class) || {{{.}}}.class.equals(Float.class) || {{{.}}}.class.equals(Double.class) || {{{.}}}.class.equals(Boolean.class) || {{{.}}}.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= (({{{.}}}.class.equals(Integer.class) || {{{.}}}.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= (({{{.}}}.class.equals(Float.class) || {{{.}}}.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= ({{{.}}}.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= ({{{.}}}.class.equals(String.class) && token == JsonToken.VALUE_STRING); + {{#isNullable}} + attemptParsing |= (token == JsonToken.VALUE_NULL); + {{/isNullable}} + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema '{{{.}}}'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e); + } + + {{/oneOf}} + if (match == 1) { + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for {{classname}}: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public {{classname}} getNullValue(DeserializationContext ctxt) throws JsonMappingException { + {{#isNullable}} + return null; + {{/isNullable}} + {{^isNullable}} + throw new JsonMappingException(ctxt.getParser(), "{{classname}} cannot be null"); + {{/isNullable}} + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public {{classname}}() { + super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + } +{{> libraries/jersey2/additional_properties }} + {{#additionalPropertiesType}} + /** + * Return true if this {{name}} object is equal to o. + */ + @Override + public boolean equals(Object o) { + return super.equals(o) && Objects.equals(this.additionalProperties, (({{classname}})o).additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); + } + {{/additionalPropertiesType}} + {{#oneOf}} + public {{classname}}({{{.}}} o) { + super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + setActualInstance(o); + } + + {{/oneOf}} + static { + {{#oneOf}} + schemas.put("{{{.}}}", new GenericType<{{{.}}}>() { + }); + {{/oneOf}} + JSON.registerDescendants({{classname}}.class, Collections.unmodifiableMap(schemas)); + {{#discriminator}} + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + {{#mappedModels}} + mappings.put("{{mappingName}}", {{modelName}}.class); + {{/mappedModels}} + mappings.put("{{name}}", {{classname}}.class); + JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings); + {{/discriminator}} + } + + @Override + public Map getSchemas() { + return {{classname}}.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}} + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + {{#isNullable}} + if (instance == null) { + super.setActualInstance(instance); + return; + } + + {{/isNullable}} + {{#oneOf}} + if (JSON.isInstanceOf({{{.}}}.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + {{/oneOf}} + throw new RuntimeException("Invalid instance type. Must be {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}"); + } + + /** + * Get the actual instance, which can be the following: + * {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}} + * + * @return The actual instance ({{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + {{#oneOf}} + /** + * Get the actual instance of `{{{.}}}`. If the actual instance is not `{{{.}}}`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `{{{.}}}` + * @throws ClassCastException if the instance is not `{{{.}}}` + */ + public {{{.}}} get{{{.}}}() throws ClassCastException { + return ({{{.}}})super.getActualInstance(); + } + + {{/oneOf}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache new file mode 100644 index 000000000000..156cc4cd5ccb --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache @@ -0,0 +1,413 @@ +/** + * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} + * @deprecated{{/isDeprecated}} + */{{#isDeprecated}} +@Deprecated{{/isDeprecated}}{{#description}} +@ApiModel(description = "{{{.}}}"){{/description}} +{{#jackson}} +@JsonPropertyOrder({ +{{#vars}} + {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} +{{/vars}} +}) +{{#isClassnameSanitized}} +@JsonTypeName("{{name}}") +{{/isClassnameSanitized}} +{{/jackson}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} +public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ +{{#serializableModel}} + private static final long serialVersionUID = 1L; + +{{/serializableModel}} + {{#vars}} + {{#isEnum}} + {{^isContainer}} + {{^vendorExtensions.x-enum-as-string}} +{{>modelInnerEnum}} + {{/vendorExtensions.x-enum-as-string}} + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} +{{>modelInnerEnum}} + {{/mostInnerItems}} + {{/isContainer}} + {{/isEnum}} + {{#gson}} + public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}"; + {{/gson}} + {{#jackson}} + public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; + {{/jackson}} + {{#withXml}} + {{#isXmlAttribute}} + @XmlAttribute(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isXmlAttribute}} + {{^isXmlAttribute}} + {{^isContainer}} + @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isContainer}} + {{#isContainer}} + // Is a container wrapped={{isXmlWrapped}} + {{#items}} + // items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}} + // items.example={{example}} items.type={{dataType}} + @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/items}} + {{#isXmlWrapped}} + @XmlElementWrapper({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isXmlWrapped}} + {{/isContainer}} + {{/isXmlAttribute}} + {{/withXml}} + {{#gson}} + @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) + {{/gson}} + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} + {{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); + {{/isContainer}} + {{^isContainer}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + {{/isContainer}} + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} + private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}}; + {{/isContainer}} + {{^isContainer}} + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + {{/isContainer}} + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{/vars}} + public {{classname}}() { {{#parent}}{{#parcelableModel}} + super();{{/parcelableModel}}{{/parent}}{{#gson}}{{#discriminator}} + this.{{{discriminatorName}}} = this.getClass().getSimpleName();{{/discriminator}}{{/gson}} + }{{#vendorExtensions.x-has-readonly-properties}}{{^withXml}}{{#jackson}} + + @JsonCreator + public {{classname}}( + {{#readOnlyVars}} + {{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} + {{/readOnlyVars}} + ) { + this(); + {{#readOnlyVars}} + this.{{name}} = {{name}}; + {{/readOnlyVars}} + }{{/jackson}}{{/withXml}}{{/vendorExtensions.x-has-readonly-properties}} + {{#vars}} + + {{^isReadOnly}} + {{#vendorExtensions.x-enum-as-string}} + public static final Set {{{nameInSnakeCase}}}_VALUES = new HashSet<>(Arrays.asList( + {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}} + )); + + {{/vendorExtensions.x-enum-as-string}} + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-enum-as-string}} + if (!{{{nameInSnakeCase}}}_VALUES.contains({{name}})) { + throw new IllegalArgumentException({{name}} + " is invalid. Possible values for {{name}}: " + String.join(", ", {{{nameInSnakeCase}}}_VALUES)); + } + + {{/vendorExtensions.x-enum-as-string}} + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + return this; + } + {{#isArray}} + + public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + } + try { + this.{{name}}.get().add({{name}}Item); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{^required}} + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}; + } + {{/required}} + this.{{name}}.add({{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isArray}} + {{#isMap}} + + public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + } + try { + this.{{name}}.get().put(key, {{name}}Item); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{^required}} + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}; + } + {{/required}} + this.{{name}}.put(key, {{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isMap}} + + {{/isReadOnly}} + /** + {{#description}} + * {{.}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{.}} + {{/minimum}} + {{#maximum}} + * maximum: {{.}} + {{/maximum}} + * @return {{name}} + {{#deprecated}} + * @deprecated + {{/deprecated}} + **/ +{{#deprecated}} + @Deprecated +{{/deprecated}} +{{#required}} +{{#isNullable}} + @jakarta.annotation.Nullable +{{/isNullable}} +{{^isNullable}} + @jakarta.annotation.Nonnull +{{/isNullable}} +{{/required}} +{{^required}} + @jakarta.annotation.Nullable +{{/required}} +{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{#vendorExtensions.x-extra-annotation}} + {{{vendorExtensions.x-extra-annotation}}} +{{/vendorExtensions.x-extra-annotation}} +{{#vendorExtensions.x-is-jackson-optional-nullable}} + {{!unannotated, Jackson would pick this up automatically and add it *in addition* to the _JsonNullable getter field}} + @JsonIgnore +{{/vendorExtensions.x-is-jackson-optional-nullable}} +{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#jackson}}{{> jackson_annotations}}{{/jackson}}{{/vendorExtensions.x-is-jackson-optional-nullable}} + public {{{datatypeWithEnum}}} {{getter}}() { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isReadOnly}}{{! A readonly attribute doesn't have setter => jackson will set null directly if explicitly returned by API, so make sure we have an empty JsonNullable}} + if ({{name}} == null) { + {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + } + {{/isReadOnly}} + return {{name}}.orElse(null); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + return {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + + {{#vendorExtensions.x-is-jackson-optional-nullable}} +{{> jackson_annotations}} + public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() { + return {{name}}; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}}{{#vendorExtensions.x-is-jackson-optional-nullable}} + @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}) + {{#isReadOnly}}private{{/isReadOnly}}{{^isReadOnly}}public{{/isReadOnly}} void {{setter}}_JsonNullable(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + {{! For getters/setters that have name differing from attribute name, we must include setter (albeit private) for jackson to be able to set the attribute}} + this.{{name}} = {{name}}; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{^isReadOnly}} +{{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}} +{{/vendorExtensions.x-setter-extra-annotation}}{{#jackson}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{> jackson_annotations}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{/jackson}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-enum-as-string}} + if (!{{{nameInSnakeCase}}}_VALUES.contains({{name}})) { + throw new IllegalArgumentException({{name}} + " is invalid. Possible values for {{name}}: " + String.join(", ", {{{nameInSnakeCase}}}_VALUES)); + } + + {{/vendorExtensions.x-enum-as-string}} + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isReadOnly}} + + {{/vars}} +{{>libraries/jersey2/additional_properties}} + /** + * Return true if this {{name}} object is equal to o. + */ + @Override + public boolean equals(Object o) { + {{#useReflectionEqualsHashCode}} + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + }{{#hasVars}} + {{classname}} {{classVarName}} = ({{classname}}) o; + return {{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} && + {{/-last}}{{/vars}}{{#additionalPropertiesType}}&& + Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/additionalPropertiesType}}{{#parent}} && + super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} + return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}} + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public int hashCode() { + {{#useReflectionEqualsHashCode}} + return HashCodeBuilder.reflectionHashCode(this); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#additionalPropertiesType}}{{#hasVars}}, {{/hasVars}}{{^hasVars}}{{#parent}}, {{/parent}}{{/hasVars}}additionalProperties{{/additionalPropertiesType}}); + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}} + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + {{/parent}} + {{#vars}} + sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + {{/vars}} + {{#additionalPropertiesType}} + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + {{/additionalPropertiesType}} + 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 "); + } + +{{#parcelableModel}} + + public void writeToParcel(Parcel out, int flags) { +{{#model}} +{{#isArray}} + out.writeList(this); +{{/isArray}} +{{^isArray}} +{{#parent}} + super.writeToParcel(out, flags); +{{/parent}} +{{#vars}} + out.writeValue({{name}}); +{{/vars}} +{{/isArray}} +{{/model}} + } + + {{classname}}(Parcel in) { +{{#isArray}} + in.readTypedList(this, {{arrayModelType}}.CREATOR); +{{/isArray}} +{{^isArray}} +{{#parent}} + super(in); +{{/parent}} +{{#vars}} +{{#isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); +{{/isPrimitiveType}} +{{^isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader()); +{{/isPrimitiveType}} +{{/vars}} +{{/isArray}} + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() { + public {{classname}} createFromParcel(Parcel in) { +{{#model}} +{{#isArray}} + {{classname}} result = new {{classname}}(); + result.addAll(in.readArrayList({{arrayModelType}}.class.getClassLoader())); + return result; +{{/isArray}} +{{^isArray}} + return new {{classname}}(in); +{{/isArray}} +{{/model}} + } + public {{classname}}[] newArray(int size) { + return new {{classname}}[size]; + } + }; +{{/parcelableModel}} +{{#discriminator}} +static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + {{#mappedModels}} + mappings.put("{{mappingName}}", {{modelName}}.class); + {{/mappedModels}} + mappings.put("{{name}}", {{classname}}.class); + JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings); +} +{{/discriminator}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pom.mustache new file mode 100644 index 000000000000..a4701007b5fc --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pom.mustache @@ -0,0 +1,401 @@ + + 4.0.0 + {{groupId}} + {{artifactId}} + jar + {{artifactId}} + {{artifactVersion}} + {{artifactUrl}} + {{artifactDescription}} + + {{scmConnection}} + {{scmDeveloperConnection}} + {{scmUrl}} + +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} + + + + {{licenseName}} + {{licenseUrl}} + repo + + + + + + {{developerName}} + {{developerEmail}} + {{developerOrganization}} + {{developerOrganizationUrl}} + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M5 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + false + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.2 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.3.2 + + + attach-javadocs + + jar + + + + + none + 1.8 + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.0 + + + attach-sources + + jar-no-fork + + + + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless.version} + + + + + + + .gitignore + + + + + + true + 4 + + + + + + + + + + 1.8 + + true + + + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + io.swagger + swagger-annotations + ${swagger-annotations-version} + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + + + org.glassfish.jersey.core + jersey-client + ${jersey-version} + + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey-version} + + + org.glassfish.jersey.media + jersey-media-multipart + ${jersey-version} + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${jersey-version} + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + + {{#openApiNullable}} + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + {{/openApiNullable}} + {{#withXml}} + + + org.glassfish.jersey.media + jersey-media-jaxb + ${jersey-version} + + {{/withXml}} + {{#joda}} + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + + {{/joda}} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + {{#hasHttpSignatureMethods}} + + org.tomitribe + tomitribe-http-signatures + ${http-signature-version} + + {{/hasHttpSignatureMethods}} + {{#hasOAuthMethods}} + + com.github.scribejava + scribejava-apis + ${scribejava-apis-version} + + {{/hasOAuthMethods}} + {{#useBeanValidation}} + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + {{/useBeanValidation}} + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + org.glassfish.jersey.connectors + jersey-apache-connector + ${jersey-version} + + + + org.junit.jupiter + junit-jupiter-api + ${junit-version} + test + + + + UTF-8 + 1.6.5 + 3.0.4 + 2.13.2 + 2.13.2 + 0.2.2 + 2.1.0 + {{#useBeanValidation}} + 2.0.2 + {{/useBeanValidation}} + 5.8.2 + {{#hasHttpSignatureMethods}} + 1.7 + {{/hasHttpSignatureMethods}} + {{#hasOAuthMethods}} + 8.3.1 + {{/hasOAuthMethods}} + 2.21.0 + + diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache index 072a496232d3..6a12dbfbb9c7 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache @@ -1197,7 +1197,7 @@ public class ApiClient { try { Response response = call.execute(); if (!response.isSuccessful()) { - throw new ApiException(response.code(), response.message()); + throw new ApiException(response.code(), response.message(), response.headers().toMultimap(), null); } if (response.body() == null) { return null; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache index b9bb3cab09ca..248211a3c165 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache @@ -457,22 +457,43 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{#items.isModel}} JsonArray jsonArray{{name}} = jsonObj.getAsJsonArray("{{{baseName}}}"); {{#isRequired}} + // ensure the json data is an array + if (!jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + // validate the required field `{{{baseName}}}` (array) for (int i = 0; i < jsonArray{{name}}.size(); i++) { {{{items.dataType}}}.validateJsonObject(jsonArray{{name}}.get(i).getAsJsonObject()); }; {{/isRequired}} {{^isRequired}} - // validate the optional field `{{{baseName}}}` (array) if (jsonArray{{name}} != null) { + // ensure the json data is an array + if (!jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + + // validate the optional field `{{{baseName}}}` (array) for (int i = 0; i < jsonArray{{name}}.size(); i++) { {{{items.dataType}}}.validateJsonObject(jsonArray{{name}}.get(i).getAsJsonObject()); }; } {{/isRequired}} {{/items.isModel}} + {{^items.isModel}} + // ensure the json data is an array + if ({{^isRequired}}jsonObj.get("{{{baseName}}}") != null && {{/isRequired}}!jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + {{/items.isModel}} {{/isArray}} {{^isContainer}} + {{#isString}} + if ({{^isRequired}}jsonObj.get("{{{baseName}}}") != null && {{/isRequired}}!jsonObj.get("{{{baseName}}}").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be a primitive type in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + {{/isString}} {{#isModel}} {{#isRequired}} // validate the required field `{{{baseName}}}` diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/pom.mustache index 5b0b09f3ccbc..4b8f2e186582 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/pom.mustache @@ -124,6 +124,7 @@ + UTF-8 {{#useBeanValidation}} 2.0.2 {{/useBeanValidation}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/pom.mustache index 413994b55671..104d0461731b 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/pom.mustache @@ -177,6 +177,7 @@ + UTF-8 1.5.18 9.2.9.v20150224 3.0.11.Final diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pom.mustache index 27a9eefb984f..08e4d8f12318 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pom.mustache @@ -194,6 +194,7 @@ + UTF-8 1.5.22 2.11.2 9.2.9.v20150224 diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/pom.mustache index 29b13f8a817c..c41fed1c5daa 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/pom.mustache @@ -50,6 +50,7 @@ + UTF-8 1.8 1.8 false 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 ad229cc7a157..c0a2e6218b04 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache @@ -150,6 +150,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.9 4.13.2 2.10.13 diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache index 316309d35ff0..f2dbeac44992 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 {{#springFoxDocumentationProvider}} 2.9.2 {{/springFoxDocumentationProvider}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache index 0fd6dcfc8ed3..67e89dc56eae 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 {{#springFoxDocumentationProvider}} 2.9.2 {{/springFoxDocumentationProvider}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index 45990ffe202f..7484633d97fc 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -164,6 +164,29 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}} } {{! end feature: getter and setter }} {{/vars}} + {{#parentVars}} + +{{! begin feature: fluent setter methods }} + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + super.{{setter}}({{name}}); + return this; + } + {{#isArray}} + + public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + super.add{{nameInCamelCase}}Item({{name}}Item); + return this; + } + {{/isArray}} + {{#isMap}} + + public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + super.put{{nameInCamelCase}}Item({{name}}Item); + return this; + } + {{/isMap}} + {{! end feature: fluent setter methods }} +{{/parentVars}} @Override public boolean equals(Object o) { @@ -178,23 +201,27 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}} {{/-last}}{{/vars}}{{#parent}} && super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} return true;{{/hasVars}} - }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + } + {{#vendorExtensions.x-jackson-optional-nullable-helpers}} private static boolean equalsNullable(JsonNullable a, JsonNullable b) { return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + } + {{/vendorExtensions.x-jackson-optional-nullable-helpers}} @Override public int hashCode() { return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); - }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + } + {{#vendorExtensions.x-jackson-optional-nullable-helpers}} private static int hashCodeNullable(JsonNullable a) { if (a == null) { return 1; } return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + } + {{/vendorExtensions.x-jackson-optional-nullable-helpers}} @Override public String toString() { diff --git a/modules/openapi-generator/src/main/resources/android/libraries/volley/pom.mustache b/modules/openapi-generator/src/main/resources/android/libraries/volley/pom.mustache index bcf9d760766f..c64ed7054e37 100644 --- a/modules/openapi-generator/src/main/resources/android/libraries/volley/pom.mustache +++ b/modules/openapi-generator/src/main/resources/android/libraries/volley/pom.mustache @@ -52,6 +52,7 @@ + UTF-8 1.5.8 4.5.2 2.6.2 diff --git a/modules/openapi-generator/src/main/resources/codegen/generatorClass.mustache b/modules/openapi-generator/src/main/resources/codegen/generatorClass.mustache index 96504e740980..4f89b0f502ad 100644 --- a/modules/openapi-generator/src/main/resources/codegen/generatorClass.mustache +++ b/modules/openapi-generator/src/main/resources/codegen/generatorClass.mustache @@ -1,7 +1,7 @@ package {{generatorPackage}}; import org.openapitools.codegen.*; -import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.*; import io.swagger.models.properties.*; import java.util.*; @@ -36,18 +36,17 @@ public class {{generatorClass}} extends DefaultCodegen implements CodegenConfig /** * Provides an opportunity to inspect and modify operation data before the code is generated. */ - @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { // to try debugging your code generator: // set a break point on the next line. // then debug the JUnit test called LaunchGeneratorInDebugger - Map results = super.postProcessOperationsWithModels(objs, allModels); + OperationsMap results = super.postProcessOperationsWithModels(objs, allModels); - Map ops = (Map)results.get("operations"); - ArrayList opList = (ArrayList)ops.get("operation"); + OperationMap ops = results.getOperations(); + List opList = ops.getOperation(); // iterate over the operation and perhaps modify something for(CodegenOperation co : opList){ @@ -196,4 +195,4 @@ public class {{generatorClass}} extends DefaultCodegen implements CodegenConfig //TODO: check that this logic is safe to escape quotation mark to avoid code injection return input.replace("\"", "\\\""); } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/codegen/kotlin/generatorClass.mustache b/modules/openapi-generator/src/main/resources/codegen/kotlin/generatorClass.mustache index 7c78604b805a..17384f2f95d9 100644 --- a/modules/openapi-generator/src/main/resources/codegen/kotlin/generatorClass.mustache +++ b/modules/openapi-generator/src/main/resources/codegen/kotlin/generatorClass.mustache @@ -2,7 +2,7 @@ package {{generatorPackage}} import org.openapitools.codegen.* -import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.*; import java.util.* import java.io.File @@ -37,11 +37,11 @@ open class {{generatorClass}}() : DefaultCodegen(), CodegenConfig { * Provides an opportunity to inspect and modify operation data before the code is generated. */ @Suppress("UNCHECKED_CAST") - override fun postProcessOperationsWithModels(objs: Map, allModels: List?): Map { + override fun postProcessOperationsWithModels(objs: OperationsMap, allModels: List?): OperationsMap { val results = super.postProcessOperationsWithModels(objs, allModels) - val ops = results["operations"] as Map - val opList = ops["operation"] as ArrayList + val ops = results.getOperations() + val opList = ops.getOperation() // iterate over the operation and perhaps modify something for (co: CodegenOperation in opList) { diff --git a/modules/openapi-generator/src/main/resources/dart-dio/enum.mustache b/modules/openapi-generator/src/main/resources/dart-dio/enum.mustache index 16ab3eeb243b..677cba3d6f2f 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/enum.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/enum.mustache @@ -11,7 +11,7 @@ class {{classname}} extends EnumClass { {{#description}} /// {{{.}}} {{/description}} - @BuiltValueEnumConst({{#isInteger}}wireNumber: {{{value}}}{{/isInteger}}{{^isInteger}}wireName: r{{#lambda.escapeBuiltValueEnum}}{{{value}}}{{/lambda.escapeBuiltValueEnum}}{{/isInteger}}) + @BuiltValueEnumConst({{#isInteger}}wireNumber: {{{value}}}{{/isInteger}}{{^isInteger}}wireName: r{{#lambda.escapeBuiltValueEnum}}{{{value}}}{{/lambda.escapeBuiltValueEnum}}{{/isInteger}}{{#enumUnknownDefaultCase}}{{#-last}}, fallback: true{{/-last}}{{/enumUnknownDefaultCase}}) static const {{classname}} {{name}} = _${{name}}; {{/enumVars}} {{/allowableValues}} diff --git a/modules/openapi-generator/src/main/resources/dart-dio/enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart-dio/enum_inline.mustache index d9432ae28f00..1670c048c079 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/enum_inline.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/enum_inline.mustache @@ -5,7 +5,7 @@ class {{{enumName}}} extends EnumClass { {{#description}} /// {{{.}}} {{/description}} - @BuiltValueEnumConst({{#isInteger}}wireNumber: {{{value}}}{{/isInteger}}{{^isInteger}}wireName: r{{#lambda.escapeBuiltValueEnum}}{{{value}}}{{/lambda.escapeBuiltValueEnum}}{{/isInteger}}) + @BuiltValueEnumConst({{#isInteger}}wireNumber: {{{value}}}{{/isInteger}}{{^isInteger}}wireName: r{{#lambda.escapeBuiltValueEnum}}{{{value}}}{{/lambda.escapeBuiltValueEnum}}{{/isInteger}}{{#enumUnknownDefaultCase}}{{#-last}}, fallback: true{{/-last}}{{/enumUnknownDefaultCase}}) static const {{{enumName}}} {{name}} = _${{#lambda.camelcase}}{{{enumName}}}{{/lambda.camelcase}}_{{name}}; {{/enumVars}} {{/allowableValues}} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum.mustache index 0668b2e7b1dc..85332bae74eb 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum.mustache @@ -11,7 +11,7 @@ class {{classname}} extends EnumClass { {{#description}} /// {{{.}}} {{/description}} - @BuiltValueEnumConst({{#isInteger}}wireNumber: {{{value}}}{{/isInteger}}{{#isLong}}wireNumber: {{{value}}}{{/isLong}}{{^isInteger}}{{^isLong}}wireName: r{{{value}}}{{/isLong}}{{/isInteger}}) + @BuiltValueEnumConst({{#isInteger}}wireNumber: {{{value}}}{{/isInteger}}{{#isLong}}wireNumber: {{{value}}}{{/isLong}}{{^isInteger}}{{^isLong}}wireName: r{{{value}}}{{/isLong}}{{/isInteger}}{{#enumUnknownDefaultCase}}{{#-last}}, fallback: true{{/-last}}{{/enumUnknownDefaultCase}}) static const {{classname}} {{name}} = _${{name}}; {{/enumVars}} {{/allowableValues}} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum_inline.mustache index c6452b7f6f5f..17763fe7479a 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum_inline.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum_inline.mustache @@ -5,7 +5,7 @@ class {{{enumName}}} extends EnumClass { {{#description}} /// {{{.}}} {{/description}} - @BuiltValueEnumConst({{#isInteger}}wireNumber: {{{value}}}{{/isInteger}}{{#isLong}}wireNumber: {{{value}}}{{/isLong}}{{^isInteger}}{{^isLong}}wireName: r{{{value}}}{{/isLong}}{{/isInteger}}) + @BuiltValueEnumConst({{#isInteger}}wireNumber: {{{value}}}{{/isInteger}}{{#isLong}}wireNumber: {{{value}}}{{/isLong}}{{^isInteger}}{{^isLong}}wireName: r{{{value}}}{{/isLong}}{{/isInteger}}{{#enumUnknownDefaultCase}}{{#-last}}, fallback: true{{/-last}}{{/enumUnknownDefaultCase}}) static const {{{enumName}}} {{name}} = _${{#lambda.camelcase}}{{{enumName}}}{{/lambda.camelcase}}_{{name}}; {{/enumVars}} {{/allowableValues}} diff --git a/modules/openapi-generator/src/main/resources/java-camel-server/pom.mustache b/modules/openapi-generator/src/main/resources/java-camel-server/pom.mustache index d7c006cc40c1..35b78586303d 100644 --- a/modules/openapi-generator/src/main/resources/java-camel-server/pom.mustache +++ b/modules/openapi-generator/src/main/resources/java-camel-server/pom.mustache @@ -38,6 +38,7 @@ Do not edit the class manually. + UTF-8 2.6.2 3.14.0 @@ -190,4 +191,4 @@ Do not edit the class manually. - \ No newline at end of file + diff --git a/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/pom.xml.mustache b/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/pom.xml.mustache index bf1768a17c2d..e51e6ead1527 100644 --- a/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/pom.xml.mustache +++ b/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/pom.xml.mustache @@ -16,6 +16,7 @@ jar 1.8 + UTF-8 {{{micronautVersion}}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/pom.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/pom.mustache index 215539ec151f..179205c3fece 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/pom.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/pom.mustache @@ -5,6 +5,9 @@ {{artifactVersion}} {{appName}} pom + + UTF-8 + diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache index a74c26927bc9..7c11199c5793 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache @@ -6,6 +6,7 @@ {{artifactId}} {{artifactVersion}} + UTF-8 1.3.30 1.2.0 1.3.5 diff --git a/modules/openapi-generator/src/main/resources/openapi-yaml/README.md b/modules/openapi-generator/src/main/resources/openapi-yaml/README.md index 6b0f68482016..613c6d787e6f 100644 --- a/modules/openapi-generator/src/main/resources/openapi-yaml/README.md +++ b/modules/openapi-generator/src/main/resources/openapi-yaml/README.md @@ -1,2 +1,2 @@ # OpenAPI YAML -This is a OpenAPI YAML built by the [openapi-generator](https://github.com/openapitools/openapi-genreator) project. \ No newline at end of file +This is a OpenAPI YAML built by the [openapi-generator](https://github.com/openapitools/openapi-generator) project. \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/openapi/README.md b/modules/openapi-generator/src/main/resources/openapi/README.md index 6c6352fdaef6..8bbce067a4de 100644 --- a/modules/openapi-generator/src/main/resources/openapi/README.md +++ b/modules/openapi-generator/src/main/resources/openapi/README.md @@ -1,2 +1,2 @@ # OpenAPI JSON -This is a OpenAPI JSON built by the [openapi-generator](https://github.com/openapitools/openapi-genreator) project. \ No newline at end of file +This is a OpenAPI JSON built by the [openapi-generator](https://github.com/openapitools/openapi-generator) project. \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache index dcd719301231..f49649f1cfe0 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache @@ -115,6 +115,22 @@ Switch your app environment to development in `public/.htaccess` file: ``` +## Mock Server +Since this feature should be used for development only, change environment to `development` and send additional HTTP header `X-{{invokerPackage}}-Mock: ping` with any request to get mocked response. +CURL example: +```console +curl --request GET \ + --url 'http://localhost:8888/v2/pet/findByStatus?status=available' \ + --header 'accept: application/json' \ + --header 'X-{{invokerPackage}}-Mock: ping' +[{"id":-8738629417578509312,"category":{"id":-4162503862215270400,"name":"Lorem ipsum dol"},"name":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem i","photoUrls":["Lor"],"tags":[{"id":-3506202845849391104,"name":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectet"}],"status":"pending"}] +``` + +Used packages: +* [Openapi Data Mocker](https://github.com/ybelenko/openapi-data-mocker) - first implementation of OAS3 fake data generator. +* [Openapi Data Mocker Server Middleware](https://github.com/ybelenko/openapi-data-mocker-server-middleware) - PSR-15 HTTP server middleware. +* [Openapi Data Mocker Interfaces](https://github.com/ybelenko/openapi-data-mocker-interfaces) - package with mocking interfaces. + {{#generateApiDocs}} ## API Endpoints diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache index f05b9c846c49..310edcb04f96 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache @@ -27,7 +27,7 @@ "slim/psr7": "^1.1.0", {{/isSlimPsr7}} "ybelenko/openapi-data-mocker": "^1.0", - "ybelenko/openapi-data-mocker-server-middleware": "^1.0" + "ybelenko/openapi-data-mocker-server-middleware": "^1.2" }, "require-dev": { "overtrue/phplint": "^2.0.2", diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/config_dev_default.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/config_dev_default.mustache index 5d5845b3cc17..5bdfb9f18774 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/config_dev_default.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/config_dev_default.mustache @@ -62,4 +62,37 @@ return [ 'pdo.options' => [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, ], + + // mocker + // OBVIOUSLY MUST NOT BE USED for production + // @see https://github.com/ybelenko/openapi-data-mocker-server-middleware + 'mocker.getMockStatusCodeCallback' => function () { + return function (\Psr\Http\Message\ServerRequestInterface $request, array $responses) { + // check if client clearly asks for mocked response + $pingHeader = 'X-{{invokerPackage}}-Mock'; + $pingHeaderCode = 'X-{{invokerPackage}}-Mock-Code'; + if ( + $request->hasHeader($pingHeader) + && $request->getHeader($pingHeader)[0] === 'ping' + ) { + $responses = (array) $responses; + $requestedResponseCode = ($request->hasHeader($pingHeaderCode)) ? $request->getHeader($pingHeaderCode)[0] : 'default'; + if (array_key_exists($requestedResponseCode, $responses)) { + return $requestedResponseCode; + } + + // return first response key + reset($responses); + return key($responses); + } + + return false; + }; + }, + 'mocker.afterCallback' => function () { + return function (\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response) { + // mark mocked response to distinguish real and fake responses + return $response->withHeader('X-{{invokerPackage}}-Mock', 'pong'); + }; + }, ]; diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/register_dependencies.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/register_dependencies.mustache index 14e1d65f884f..732325d09e00 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/register_dependencies.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/register_dependencies.mustache @@ -59,6 +59,15 @@ final class RegisterDependencies \DI\get('pdo.password'), \DI\get('pdo.options', null) ), + + // DataMocker + // @see https://github.com/ybelenko/openapi-data-mocker-server-middleware + \OpenAPIServer\Mock\OpenApiDataMockerInterface::class => \DI\create(\OpenAPIServer\Mock\OpenApiDataMocker::class) + ->method('setModelsNamespace', '{{modelPackage}}\\'), + + \OpenAPIServer\Mock\OpenApiDataMockerRouteMiddlewareFactory::class => \DI\autowire() + ->constructorParameter('getMockStatusCodeCallback', \DI\get('mocker.getMockStatusCodeCallback')) + ->constructorParameter('afterCallback', \DI\get('mocker.afterCallback')), ]); } } diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/register_routes.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/register_routes.mustache index 35bf34e3a0a0..8b1cbf98adae 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/register_routes.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/register_routes.mustache @@ -116,6 +116,16 @@ class RegisterRoutes return $response; }); + // create mock middleware factory + /** @var \Psr\Container\ContainerInterface */ + $container = $app->getContainer(); + /** @var \OpenAPIServer\Mock\OpenApiDataMockerRouteMiddlewareFactory|null */ + $mockMiddlewareFactory = null; + if ($container->has(\OpenAPIServer\Mock\OpenApiDataMockerRouteMiddlewareFactory::class)) { + // I know, anti-pattern. Don't retrieve dependency directly from container + $mockMiddlewareFactory = $container->get(\OpenAPIServer\Mock\OpenApiDataMockerRouteMiddlewareFactory::class); + } + foreach ($this->operations as $operation) { $callback = function (ServerRequestInterface $request) use ($operation) { $message = "How about extending {$operation['classname']} by {$operation['apiPackage']}\\{$operation['userClassname']} class implementing {$operation['operationId']} as a {$operation['httpMethod']} method?"; @@ -129,6 +139,13 @@ class RegisterRoutes $callback = ["\\{$operation['apiPackage']}\\{$operation['userClassname']}", $operation['operationId']]; } + if ($mockMiddlewareFactory) { + $mockSchemaResponses = array_map(function ($item) { + return json_decode($item['jsonSchema'], true); + }, $operation['responses']); + $middlewares[] = $mockMiddlewareFactory->create($mockSchemaResponses); + } + $route = $app->map( [$operation['httpMethod']], "{$operation['basePathWithoutHost']}{$operation['path']}", diff --git a/modules/openapi-generator/src/main/resources/powershell/model.mustache b/modules/openapi-generator/src/main/resources/powershell/model.mustache index a4b90baee9f4..9b81320e23ce 100644 --- a/modules/openapi-generator/src/main/resources/powershell/model.mustache +++ b/modules/openapi-generator/src/main/resources/powershell/model.mustache @@ -1,6 +1,11 @@ {{> partial_header}} {{#models}} {{#model}} +{{#isEnum}} +{{>model_enum}} +{{/isEnum}} +{{^isEnum}} {{#oneOf}}{{#-first}}{{>model_oneof}}{{/-first}}{{/oneOf}}{{^oneOf}}{{#anyOf}}{{#-first}}{{>model_anyof}}{{/-first}}{{/anyOf}}{{^anyOf}}{{>model_simple}}{{/anyOf}}{{/oneOf}} +{{/isEnum}} {{/model}} {{/models}} diff --git a/modules/openapi-generator/src/main/resources/powershell/model_enum.mustache b/modules/openapi-generator/src/main/resources/powershell/model_enum.mustache new file mode 100644 index 000000000000..067e039808cc --- /dev/null +++ b/modules/openapi-generator/src/main/resources/powershell/model_enum.mustache @@ -0,0 +1,18 @@ +<# +.SYNOPSIS + +{{{summary}}}{{^summary}}Enum {{{classname}}}.{{/summary}} + +.DESCRIPTION + +{{{description}}}{{^description}}No description available.{{/description}} +#> + +enum {{{classname}}} { + {{#allowableValues}} + {{#enumVars}} + # enum value: {{{value}}} + {{{name}}} + {{/enumVars}} + {{/allowableValues}} +} diff --git a/modules/openapi-generator/src/main/resources/python-experimental/README_common.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/README_common.handlebars index 5c57735164b4..4a6dd287ea7e 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/README_common.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/README_common.handlebars @@ -88,7 +88,7 @@ Class | Method | HTTP request | Description ## Author -{{#with apiInfo}}{{#each apis}}{{#unless hasMore}}{{infoEmail}} +{{#with apiInfo}}{{#each apis}}{{#unless hasMore}}{{#if infoEmail}}{{infoEmail}}{{/if}} {{/unless}}{{/each}}{{/with}} ## Notes for Large OpenAPI documents diff --git a/modules/openapi-generator/src/main/resources/python-experimental/__init__api_endpoints.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/__init__api_endpoints.handlebars new file mode 100644 index 000000000000..2bb5d7837bb2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-experimental/__init__api_endpoints.handlebars @@ -0,0 +1,3 @@ +# do not import all endpoints into this module because that uses a lot of memory and stack frames +# if you need the ability to import all endpoints from this module, import them with +# from {{packageName}}.api.{{apiModuleName}} import {{classname}} diff --git a/modules/openapi-generator/src/main/resources/python-experimental/__init__apis.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/__init__apis.handlebars index 06fb33610b2a..16dfd5cd690b 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/__init__apis.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/__init__apis.handlebars @@ -10,7 +10,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from {{packagename}}.{{apiPackage}}.{{classFilename}} import {{classname}} +# from {{packageName}}.{{apiPackage}}.{{classFilename}} import {{classname}} # # or import this package, but before doing it, use: # diff --git a/modules/openapi-generator/src/main/resources/python-experimental/api_doc.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/api_doc.handlebars index 6e74b8abb831..546e61a8d869 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/api_doc.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/api_doc.handlebars @@ -13,7 +13,7 @@ Method | HTTP request | Description # **{{{operationId}}}** > {{#if returnType}}{{{returnType}}} {{/if}}{{{operationId}}}({{#each requiredParams}}{{#unless defaultValue}}{{paramName}}{{#if hasMore}}, {{/if}}{{/unless}}{{/each}}) -{{{summary}}}{{#if notes}} +{{#if summary}}{{{summary}}}{{/if}}{{#if notes}} {{{notes}}}{{/if}} @@ -159,9 +159,9 @@ Code | Class | Description n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned {{#each responses}} {{#if isDefault}} -default | ApiResponseForDefault | {{message}} {{description}} +default | ApiResponseForDefault | {{message}} {{else}} -{{code}} | ApiResponseFor{{code}} | {{message}} {{description}} +{{code}} | ApiResponseFor{{code}} | {{message}} {{/if}} {{/each}} {{#each responses}} diff --git a/modules/openapi-generator/src/main/resources/python-experimental/api_doc_schema_type_hint.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/api_doc_schema_type_hint.handlebars index 0698320ad88d..ffed97b72b52 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/api_doc_schema_type_hint.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/api_doc_schema_type_hint.handlebars @@ -3,7 +3,7 @@ {{#if complexType}} Type | Description | Notes ------------- | ------------- | ------------- -[**{{dataType}}**]({{complexType}}.md) | {{description}} | {{#if isReadOnly}}[readonly] {{/if}} +[**{{dataType}}**]({{complexType}}.md) | {{#if description}}{{description}}{{/if}} | {{#if isReadOnly}}[readonly] {{/if}} {{else}} {{> schema_doc }} diff --git a/modules/openapi-generator/src/main/resources/python-experimental/configuration.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/configuration.handlebars index c0a0dc7dcc27..8837fa9515df 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/configuration.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/configuration.handlebars @@ -559,13 +559,13 @@ conf = {{{packageName}}}.Configuration( {{#each servers}} { 'url': "{{{url}}}", - 'description': "{{{description}}}{{#unless description}}No description provided{{/unless}}", + 'description': "{{#unless description}}No description provided{{else}}{{{description}}}{{/unless}}", {{#each variables}} {{#if @first}} 'variables': { {{/if}} '{{{name}}}': { - 'description': "{{{description}}}{{#unless description}}No description provided{{/unless}}", + 'description': "{{#unless description}}No description provided{{else}}{{{description}}}{{/unless}}", 'default_value': "{{{defaultValue}}}", {{#each enumValues}} {{#if @first}} diff --git a/modules/openapi-generator/src/main/resources/python-experimental/endpoint.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/endpoint.handlebars index f6de978e4781..4eb79c83fc44 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/endpoint.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/endpoint.handlebars @@ -208,13 +208,13 @@ _servers = ( {{/if}} { 'url': "{{{url}}}", - 'description': "{{{description}}}{{#unless description}}No description provided{{/unless}}", + 'description': "{{#unless description}}No description provided{{else}}{{{description}}}{{/unless}}", {{#each variables}} {{#if @first}} 'variables': { {{/if}} '{{{name}}}': { - 'description': "{{{description}}}{{#unless description}}No description provided{{/unless}}", + 'description': "{{#unless description}}No description provided{{else}}{{{description}}}{{/unless}}", 'default_value': "{{{defaultValue}}}", {{#each enumValues}} {{#if @first}} diff --git a/modules/openapi-generator/src/main/resources/python-experimental/schema_doc.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/schema_doc.handlebars index 556d2cbb5f95..5fe246825e59 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/schema_doc.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/schema_doc.handlebars @@ -8,7 +8,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- {{#each vars}} -**{{baseName}}** | {{#unless complexType}}**{{dataType}}**{{/unless}}{{#if complexType}}[**{{dataType}}**]({{complexType}}.md){{/if}} | {{description}} | {{#unless required}}[optional] {{/unless}}{{#if isReadOnly}}[readonly] {{/if}}{{#if defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/if}} +**{{baseName}}** | {{#unless complexType}}**{{dataType}}**{{/unless}}{{#if complexType}}[**{{dataType}}**]({{complexType}}.md){{/if}} | {{#if description}}{{description}}{{/if}} | {{#unless required}}[optional] {{/unless}}{{#if isReadOnly}}[readonly] {{/if}}{{#if defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/if}} {{/each}} {{#with additionalProperties}} **any string name** | **{{dataType}}** | any string name can be used but the value must be the correct type | [optional] @@ -23,9 +23,9 @@ typing.Union[dict, frozendict, str, date, datetime, int, float, bool, Decimal, N typing.Union[{{#if isMap}}dict, frozendict, {{/if}}{{#if isString}}str, {{/if}}{{#if isDate}}date, {{/if}}{{#if isDataTime}}datetime, {{/if}}{{#or isLong isShort isUnboundedInteger}}int, {{/or}}{{#or isFloat isDouble}}float, {{/or}}{{#if isNumber}}Decimal, {{/if}}{{#if isBoolean}}bool, {{/if}}{{#if isNull}}None, {{/if}}{{#if isArray}}list, tuple, {{/if}}{{#if isBinary}}bytes{{/if}}] | | {{#with allowableValues}}{{#if defaultValue}}, {{/if}} must be one of [{{#each enumVars}}{{{value}}}, {{/each}}]{{/with}} {{else}} {{#if isArray}} -{{#unless arrayModelType}}**{{dataType}}**{{/unless}}{{#if arrayModelType}}[**{{dataType}}**]({{arrayModelType}}.md){{/if}} | {{description}} | {{#if defaultValue}}{{#if hasRequired}} if omitted the server will use the default value of {{/if}}{{#unless hasRequired}}defaults to {{/unless}}{{{defaultValue}}}{{/if}} +{{#unless arrayModelType}}**{{dataType}}**{{/unless}}{{#if arrayModelType}}[**{{dataType}}**]({{arrayModelType}}.md){{/if}} | {{#if description}}{{description}}{{/if}} | {{#if defaultValue}}{{#if hasRequired}} if omitted the server will use the default value of {{/if}}{{#unless hasRequired}}defaults to {{/unless}}{{{defaultValue}}}{{/if}} {{else}} -{{#unless arrayModelType}}**{{dataType}}**{{/unless}} | {{description}} | {{#if defaultValue}}{{#if hasRequired}} if omitted the server will use the default value of {{/if}}{{#unless hasRequired}}defaults to {{/unless}}{{{defaultValue}}}{{/if}}{{#with allowableValues}}{{#if defaultValue}}, {{/if}} must be one of [{{#each enumVars}}{{{value}}}, {{/each}}]{{/with}} +{{#unless arrayModelType}}**{{dataType}}**{{/unless}} | {{#if description}}{{description}}{{/if}} | {{#if defaultValue}}{{#if hasRequired}} if omitted the server will use the default value of {{/if}}{{#unless hasRequired}}defaults to {{/unless}}{{{defaultValue}}}{{/if}}{{#with allowableValues}}{{#if defaultValue}}, {{/if}} must be one of [{{#each enumVars}}{{{value}}}, {{/each}}]{{/with}} {{/if}} {{/if}} {{/if}} diff --git a/modules/openapi-generator/src/main/resources/python-experimental/setup.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/setup.handlebars index 7045d259412f..5633db861aa6 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/setup.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/setup.handlebars @@ -37,7 +37,7 @@ setup( description="{{appName}}", author="{{#if infoName}}{{infoName}}{{/if}}{{#unless infoName}}OpenAPI Generator community{{/unless}}", author_email="{{#if infoEmail}}{{infoEmail}}{{/if}}{{#unless infoEmail}}team@openapitools.org{{/unless}}", - url="{{packageUrl}}", + url="{{#if packageUrl}}{{packageUrl}}{{/if}}", keywords=["OpenAPI", "OpenAPI-Generator", "{{{appName}}}"], python_requires="{{{generatorLanguageVersion}}}", install_requires=REQUIRES, diff --git a/modules/openapi-generator/src/main/resources/python/__init__apis.mustache b/modules/openapi-generator/src/main/resources/python/__init__apis.mustache index 927bb6d52c43..76449d186a67 100644 --- a/modules/openapi-generator/src/main/resources/python/__init__apis.mustache +++ b/modules/openapi-generator/src/main/resources/python/__init__apis.mustache @@ -9,7 +9,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from {{packagename}}.api.{{classFilename}} import {{classname}} +# from {{packageName}}.api.{{classFilename}} import {{classname}} # # or import this package, but before doing it, use: # diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache index 8a79f43a6ede..1116c12aea49 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache @@ -10,9 +10,10 @@ :client_cert => @config.ssl_client_cert, :client_key => @config.ssl_client_key } - - connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn| - conn.proxy = config.proxy if config.proxy + request_options = { + :params_encoder => @config.params_encoder + } + connection = Faraday.new(:url => config.base_url, :ssl => ssl_options, :request => request_options) do |conn| conn.request(:basic_auth, config.username, config.password) @config.configure_middleware(conn) if opts[:header_params]["Content-Type"] == "multipart/form-data" @@ -84,7 +85,7 @@ request.body = req_body # Overload default options only if provided - request.options.params_encoding = @config.params_encoding if @config.params_encoding + request.options.params_encoder = @config.params_encoder if @config.params_encoder request.options.timeout = @config.timeout if @config.timeout request.options.verbose = @config.debugging if @config.debugging diff --git a/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache b/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache index b2c8386ebe0e..46319a3cdb9a 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache @@ -84,17 +84,11 @@ module {{moduleName}} attr_accessor :client_side_validation {{^isFaraday}} -{{> configuration_tls_typhoeus_partial}} +{{> configuration_typhoeus_partial}} {{/isFaraday}} {{#isFaraday}} -{{> configuration_tls_faraday_partial}} +{{> configuration_faraday_partial}} {{/isFaraday}} - # Set this to customize parameters encoding of array parameter with multi collectionFormat. - # Default to nil. - # - # @see The params_encoding option of Ethon. Related source code: - # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 - attr_accessor :params_encoding attr_accessor :inject_format @@ -123,14 +117,15 @@ module {{moduleName}} @timeout = 60 # return data as binary instead of file @return_binary_data = false + @params_encoder = nil {{/isFaraday}} {{^isFaraday}} @verify_ssl = true @verify_ssl_host = true - @params_encoding = nil @cert_file = nil @key_file = nil @timeout = 0 + @params_encoding = nil {{/isFaraday}} @debugging = false @inject_format = false diff --git a/modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_faraday_partial.mustache b/modules/openapi-generator/src/main/resources/ruby-client/configuration_faraday_partial.mustache similarity index 78% rename from modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_faraday_partial.mustache rename to modules/openapi-generator/src/main/resources/ruby-client/configuration_faraday_partial.mustache index 598186a7f930..83cbf9657479 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_faraday_partial.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/configuration_faraday_partial.mustache @@ -31,3 +31,10 @@ ### Proxy setting # HTTP Proxy settings attr_accessor :proxy + + # Set this to customize parameters encoder of array parameter. + # Default to nil. Faraday uses NestedParamsEncoder when nil. + # + # @see The params_encoder option of Faraday. Related source code: + # https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders + attr_accessor :params_encoder diff --git a/modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_typhoeus_partial.mustache b/modules/openapi-generator/src/main/resources/ruby-client/configuration_typhoeus_partial.mustache similarity index 79% rename from modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_typhoeus_partial.mustache rename to modules/openapi-generator/src/main/resources/ruby-client/configuration_typhoeus_partial.mustache index b75954c254a9..b117e2030bce 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_typhoeus_partial.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/configuration_typhoeus_partial.mustache @@ -32,3 +32,10 @@ ### TLS/SSL setting # Client private key file (for client certificate) attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/modelGeneric.mustache index 06da8db77a66..6444507b8ebe 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/modelGeneric.mustache @@ -5,7 +5,7 @@ */ export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ {{#additionalPropertiesType}} - [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + [key: string]: {{{additionalPropertiesType}}}{{^additionalPropertiesIsAnyType}}{{#hasVars}} | any{{/hasVars}}{{/additionalPropertiesIsAnyType}}; {{/additionalPropertiesType}} {{#vars}} diff --git a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache index 2f8cbb604920..8b1adeb71556 100644 --- a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache @@ -4,7 +4,7 @@ import {Configuration} from '../configuration{{extensionForDeno}}'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http{{extensionForDeno}}'; {{#platforms}} {{#node}} -import * as FormData from "form-data"; +import {{^supportsES6}}* as{{/supportsES6}} FormData from "form-data"; import { URLSearchParams } from 'url'; {{/node}} {{/platforms}} diff --git a/modules/openapi-generator/src/main/resources/typescript/auth/auth.mustache b/modules/openapi-generator/src/main/resources/typescript/auth/auth.mustache index 09ff0ca2bb9a..20db6609fc98 100644 --- a/modules/openapi-generator/src/main/resources/typescript/auth/auth.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/auth/auth.mustache @@ -1,8 +1,8 @@ -// typings for btoa are incorrect {{#platforms}} {{#node}} +// typings for btoa are incorrect //@ts-ignore -import * as btoa from "btoa"; +import {{^supportsES6}}* as{{/supportsES6}} btoa from "btoa"; {{/node}} {{/platforms}} import { RequestContext } from "../http/http{{extensionForDeno}}"; diff --git a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache index 2f66d4b8996e..52fdb8754f21 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache @@ -1,7 +1,7 @@ {{#platforms}} {{#node}} // TODO: evaluate if we can easily get rid of this library -import * as FormData from "form-data"; +import {{^supportsES6}}* as{{/supportsES6}} FormData from "form-data"; import { URLSearchParams } from 'url'; import * as http from 'http'; import * as https from 'https'; @@ -9,9 +9,7 @@ import * as https from 'https'; {{/platforms}} {{#platforms}} {{^deno}} -// typings of url-parse are incorrect... -// @ts-ignore -import * as URLParse from "url-parse"; +import {{^supportsES6}}* as{{/supportsES6}} URLParse from "url-parse"; {{/deno}} {{/platforms}} import { Observable, from } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'../rxjsStub{{extensionForDeno}}'{{/useRxJS}}; diff --git a/modules/openapi-generator/src/main/resources/typescript/index.mustache b/modules/openapi-generator/src/main/resources/typescript/index.mustache index b19f7f9348a9..24fe1285226e 100644 --- a/modules/openapi-generator/src/main/resources/typescript/index.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/index.mustache @@ -5,6 +5,7 @@ export { createConfiguration } from "./configuration{{extensionForDeno}}" export{{#platforms}}{{#deno}} type{{/deno}}{{/platforms}} { Configuration } from "./configuration{{extensionForDeno}}" export * from "./apis/exception{{extensionForDeno}}"; export * from "./servers{{extensionForDeno}}"; +export { RequiredError } from "./apis/baseapi{{extensionForDeno}}"; {{#useRxJS}} export { Middleware } from './middleware{{extensionForDeno}}'; diff --git a/modules/openapi-generator/src/main/resources/typescript/package.mustache b/modules/openapi-generator/src/main/resources/typescript/package.mustache index 807989026b14..1483e4d9eace 100644 --- a/modules/openapi-generator/src/main/resources/typescript/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/package.mustache @@ -11,6 +11,16 @@ ], "license": "Unlicense", "main": "./dist/index.js", + {{#supportsES6}} + "type": "module", + "module": "./dist/index.js", + {{/supportsES6}} + {{^supportsES6}} + "type": "commonjs", + {{/supportsES6}} + "exports": { + ".": "./dist/index.js" + }, "typings": "./dist/index.d.ts", "scripts": { "build": "tsc", @@ -51,7 +61,8 @@ "url-parse": "^1.4.3" }, "devDependencies": { - "typescript": "^3.9.3" + "typescript": "^3.9.3", + "@types/url-parse": "1.4.4" }{{#npmRepository}},{{/npmRepository}} {{#npmRepository}} "publishConfig":{ diff --git a/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache index 011a217eb063..b7aa518c46e4 100644 --- a/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache @@ -2,8 +2,13 @@ "compilerOptions": { "strict": true, /* Basic Options */ - "target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}", - "module": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}commonjs{{/supportsES6}}", + {{#supportsES6}} + "target": "es6", + "esModuleInterop": true, + {{/supportsES6}} + {{^supportsES6}} + "target": "es5", + {{/supportsES6}} "moduleResolution": "node", "declaration": true, 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 fac01dbf2bb2..a7fd0ebb462c 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 @@ -449,7 +449,7 @@ public void testAdditionalPropertiesV3SpecDisallowAdditionalPropertiesIfNotPrese // extended with any undeclared properties. Schema addProps = ModelUtils.getAdditionalProperties(openAPI, componentSchema); Assert.assertNotNull(addProps); - Assert.assertTrue(addProps instanceof ObjectSchema); + Assert.assertEquals(addProps, new Schema()); CodegenModel cm = codegen.fromModel("AdditionalPropertiesClass", componentSchema); Assert.assertNotNull(cm.getAdditionalProperties()); @@ -494,7 +494,7 @@ public void testAdditionalPropertiesV3SpecDisallowAdditionalPropertiesIfNotPrese Assert.assertNull(map_with_undeclared_properties_anytype_1_sc.getAdditionalProperties()); addProps = ModelUtils.getAdditionalProperties(openAPI, map_with_undeclared_properties_anytype_1_sc); Assert.assertNotNull(addProps); - Assert.assertTrue(addProps instanceof ObjectSchema); + Assert.assertEquals(addProps, new Schema()); Assert.assertNotNull(map_with_undeclared_properties_anytype_1_cp.getAdditionalProperties()); // map_with_undeclared_properties_anytype_2 @@ -504,7 +504,7 @@ public void testAdditionalPropertiesV3SpecDisallowAdditionalPropertiesIfNotPrese Assert.assertNull(map_with_undeclared_properties_anytype_2_sc.getAdditionalProperties()); addProps = ModelUtils.getAdditionalProperties(openAPI, map_with_undeclared_properties_anytype_2_sc); Assert.assertNotNull(addProps); - Assert.assertTrue(addProps instanceof ObjectSchema); + Assert.assertEquals(addProps, new Schema()); Assert.assertNotNull(map_with_undeclared_properties_anytype_2_cp.getAdditionalProperties()); // map_with_undeclared_properties_anytype_3 @@ -517,7 +517,7 @@ public void testAdditionalPropertiesV3SpecDisallowAdditionalPropertiesIfNotPrese Assert.assertEquals(map_with_undeclared_properties_anytype_3_sc.getAdditionalProperties(), Boolean.TRUE); addProps = ModelUtils.getAdditionalProperties(openAPI, map_with_undeclared_properties_anytype_3_sc); Assert.assertNotNull(addProps); - Assert.assertTrue(addProps instanceof ObjectSchema); + Assert.assertEquals(addProps, new Schema()); Assert.assertNotNull(map_with_undeclared_properties_anytype_3_cp.getAdditionalProperties()); // empty_map @@ -2769,6 +2769,26 @@ public void testAdditionalPropertiesPresentInResponses() { } } + @Test + public void testAdditionalPropertiesAnyType() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_9282.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + CodegenProperty anyTypeSchema = codegen.fromProperty("", new Schema()); + + Schema sc; + CodegenModel cm; + + sc = openAPI.getComponents().getSchemas().get("AdditionalPropertiesTrue"); + cm = codegen.fromModel("AdditionalPropertiesTrue", sc); + assertEquals(cm.getVars().get(0).additionalProperties, anyTypeSchema); + + sc = openAPI.getComponents().getSchemas().get("AdditionalPropertiesAnyType"); + cm = codegen.fromModel("AdditionalPropertiesAnyType", sc); + assertEquals(cm.getVars().get(0).additionalProperties, anyTypeSchema); + } + @Test public void testIsXPresence() { final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java index d2ae77e2190e..6615034a1ea1 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java @@ -14,6 +14,7 @@ import org.openapitools.codegen.config.CodegenConfigurator; import org.openapitools.codegen.config.GlobalSettings; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.utils.ModelUtils; import org.testng.Assert; import org.testng.annotations.Test; @@ -654,7 +655,7 @@ public void testHandlesTrailingSlashInServers() { List filteredSchemas = ModelUtils.getSchemasUsedOnlyInFormParam(openAPI); List allModels = new ArrayList<>(); generator.generateModels(files, allModels, filteredSchemas); - List allOperations = new ArrayList<>(); + List allOperations = new ArrayList<>(); generator.generateApis(files, allOperations, allModels); Map bundle = generator.buildSupportFileBundle(allOperations, allModels); @@ -680,7 +681,7 @@ public void testHandlesRelativeUrlsInServers() { List filteredSchemas = ModelUtils.getSchemasUsedOnlyInFormParam(openAPI); List allModels = new ArrayList<>(); generator.generateModels(files, allModels, filteredSchemas); - List allOperations = new ArrayList<>(); + List allOperations = new ArrayList<>(); generator.generateApis(files, allOperations, allModels); Map bundle = generator.buildSupportFileBundle(allOperations, allModels); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/AbstractGoCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/AbstractGoCodegenTest.java index 4bb8762268df..c232ff4d8eaa 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/AbstractGoCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/AbstractGoCodegenTest.java @@ -22,6 +22,7 @@ import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.IntegerSchema; import io.swagger.v3.oas.models.media.MapSchema; +import io.swagger.v3.oas.models.media.ObjectSchema; import io.swagger.v3.oas.models.media.Schema; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenType; @@ -90,6 +91,13 @@ public void getTypeDeclarationTest() { ModelUtils.setGenerateAliasAsModel(true); defaultValue = codegen.getTypeDeclaration(schema); Assert.assertEquals(defaultValue, "map[string]NestedArray"); + + // Create object schema with additionalProperties set to true + schema = new ObjectSchema().additionalProperties(Boolean.TRUE); + + ModelUtils.setGenerateAliasAsModel(false); + defaultValue = codegen.getTypeDeclaration(schema); + Assert.assertEquals(defaultValue, "map[string]interface{}"); } private static class P_AbstractGoCodegen extends AbstractGoCodegen { diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaCXFClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaCXFClientCodegenTest.java index abe7aee34117..b2e7cf66993c 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaCXFClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaCXFClientCodegenTest.java @@ -29,6 +29,8 @@ import org.openapitools.codegen.languages.features.GzipTestFeatures; import org.openapitools.codegen.languages.features.LoggingTestFeatures; import org.openapitools.codegen.languages.features.UseGenericResponseFeatures; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.testng.Assert; import org.testng.annotations.Test; @@ -52,9 +54,12 @@ public void responseWithoutContent() throws Exception { final JavaCXFClientCodegen codegen = new JavaCXFClientCodegen(); final CodegenOperation co = codegen.fromOperation("getAllPets", "GET", operation, null); - Map objs = new HashMap<>(); - objs.put("operations", Collections.singletonMap("operation", Collections.singletonList(co))); - objs.put("imports", Collections.emptyList()); + OperationMap operationMap = new OperationMap(); + operationMap.setOperation(co); + + OperationsMap objs = new OperationsMap(); + objs.setOperation(operationMap); + objs.setImports(Collections.emptyList()); codegen.postProcessOperationsWithModels(objs, Collections.emptyList()); Assert.assertEquals(co.responses.size(), 2); 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 99892f884bef..ad00fb1281da 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 @@ -59,6 +59,8 @@ import org.openapitools.codegen.languages.JavaClientCodegen; import org.openapitools.codegen.languages.features.BeanValidationFeatures; import org.openapitools.codegen.languages.features.CXFServerFeatures; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.testng.Assert; import org.testng.annotations.Ignore; import org.testng.annotations.Test; @@ -136,9 +138,12 @@ public void testParametersAreCorrectlyOrderedWhenUsingRetrofit() { CodegenParameter pathParam2 = createPathParam("pathParam2"); codegenOperation.allParams.addAll(Arrays.asList(queryParamRequired, pathParam1, pathParam2, queryParamOptional)); - Map operations = ImmutableMap.of("operation", Arrays.asList(codegenOperation)); + OperationMap operations = new OperationMap(); + operations.setOperation(codegenOperation); - Map objs = ImmutableMap.of("operations", operations, "imports", new ArrayList>()); + OperationsMap objs = new OperationsMap(); + objs.setOperation(operations); + objs.setImports(new ArrayList<>()); javaClientCodegen.postProcessOperationsWithModels(objs, Collections.emptyList()); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/AbstractJavaJAXRSServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/AbstractJavaJAXRSServerCodegenTest.java index bd10d0beffc1..e1c3d5f710ab 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/AbstractJavaJAXRSServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/AbstractJavaJAXRSServerCodegenTest.java @@ -23,6 +23,8 @@ import org.openapitools.codegen.CodegenOperation; import org.openapitools.codegen.CodegenType; import org.openapitools.codegen.languages.AbstractJavaJAXRSServerCodegen; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.testng.Assert; import org.testng.annotations.Test; @@ -108,11 +110,11 @@ public void testAdditionalPropertiesPutForConfigValues() throws Exception { @Test public void testCommonPath() { final AbstractJavaJAXRSServerCodegen codegen = new P_AbstractJavaJAXRSServerCodegen(); - Map objs = new HashMap<>(); - Map> opMap = new HashMap<>(); + OperationsMap objs = new OperationsMap(); + OperationMap opMap = new OperationMap(); List operations = new ArrayList<>(); - objs.put("operations", opMap); - opMap.put("operation", operations); + objs.setOperation(opMap); + opMap.setOperation(operations); operations.add(getCo("/")); codegen.postProcessOperationsWithModels(objs, Collections.emptyList()); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index cd7a9c95b6a2..de2b775456bd 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -987,6 +987,49 @@ public void oneOf_5381() throws IOException { assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/FooRefOrValue.java"), "public interface FooRefOrValue"); } + @Test + public void oneOf_allOf() throws IOException { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + String outputPath = output.getAbsolutePath().replace('\\', '/'); + OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml", null, new ParseOptions()).getOpenAPI(); + + SpringCodegen codegen = new SpringCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + codegen.setUseOneOfInterfaces(true); + + ClientOptInput input = new ClientOptInput(); + input.openAPI(openAPI); + input.config(codegen); + + DefaultGenerator generator = new DefaultGenerator(); + codegen.setHateoas(true); + generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true"); +// generator.setGeneratorPropertyDefault(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, "true"); + generator.setGeneratorPropertyDefault(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "false"); + + codegen.setUseOneOfInterfaces(true); + codegen.setLegacyDiscriminatorBehavior(false); + + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true"); + generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false"); + + generator.opts(input).generate(); + + assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/Foo.java"), "public class Foo extends Entity implements FooRefOrValue"); + assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/FooRef.java"), "public class FooRef extends EntityRef implements FooRefOrValue"); + assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/FooRefOrValue.java"), "public interface FooRefOrValue"); + // previous bugs + assertFileNotContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/BarRef.java"), "atTypesuper.hashCode"); + assertFileNotContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/BarRef.java"), "private String atBaseType"); + // imports for inherited properties + assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/PizzaSpeziale.java"), "import java.math.BigDecimal"); + } + @Test public void testTypeMappings() { final SpringCodegen codegen = new SpringCodegen(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java index 5ef7c8433737..08bc443e3347 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java @@ -25,6 +25,8 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.languages.RubyClientCodegen; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.testng.Assert; import org.testng.annotations.Test; @@ -164,10 +166,13 @@ public void bodyParameterTest() { modelMap.setModel(model); final CodegenOperation op = codegen.fromOperation(path, "post", p, null); - Map operations = ImmutableMap.of("operation", Collections.singletonList(op)); - Map objs = ImmutableMap.of("operations", operations, "imports", new ArrayList>()); + OperationMap operations = new OperationMap(); + operations.setOperation(op); + OperationsMap objs = new OperationsMap(); + objs.setOperation(operations); + objs.setImports(new ArrayList<>()); objs = codegen.postProcessOperationsWithModels(objs, Collections.singletonList(modelMap)); - CodegenOperation postProcessedOp = ((List) ((Map) objs.get("operations")).get("operation")).get(0); + CodegenOperation postProcessedOp = objs.getOperations().getOperation().get(0); Assert.assertEquals(postProcessedOp.bodyParams.size(), 1); CodegenParameter bp = postProcessedOp.bodyParams.get(0); Assert.assertEquals(bp.vendorExtensions.get("x-ruby-example"), "OnlinePetstore::Pet.new({name: 'doggie', photo_urls: ['photo_urls_example']})"); @@ -628,10 +633,13 @@ public void exampleStringFromExampleParameterOAS2Test() { final Operation p = openAPI.getPaths().get(path).getDelete(); final CodegenOperation op = codegen.fromOperation(path, "delete", p, null); - Map operations = ImmutableMap.of("operation", Collections.singletonList(op)); - Map objs = ImmutableMap.of("operations", operations, "imports", new ArrayList>()); + OperationMap operations = new OperationMap(); + operations.setOperation(op); + OperationsMap objs = new OperationsMap(); + objs.setOperation(operations); + objs.setImports(new ArrayList<>()); objs = codegen.postProcessOperationsWithModels(objs, Collections.emptyList()); - CodegenOperation postProcessedOp = ((List) ((Map) objs.get("operations")).get("operation")).get(0); + CodegenOperation postProcessedOp = objs.getOperations().getOperation().get(0); CodegenParameter pp = postProcessedOp.pathParams.get(0); Assert.assertEquals(pp.vendorExtensions.get("x-ruby-example"), "'orderid123'"); @@ -648,10 +656,13 @@ public void exampleStringFromXExampleParameterOAS3Test() { final Operation p = openAPI.getPaths().get(path).getDelete(); final CodegenOperation op = codegen.fromOperation(path, "delete", p, null); - Map operations = ImmutableMap.of("operation", Collections.singletonList(op)); - Map objs = ImmutableMap.of("operations", operations, "imports", new ArrayList>()); + OperationMap operations = new OperationMap(); + operations.setOperation(op); + OperationsMap objs = new OperationsMap(); + objs.setOperation(operations); + objs.setImports(new ArrayList<>()); objs = codegen.postProcessOperationsWithModels(objs, Collections.emptyList()); - CodegenOperation postProcessedOp = ((List) ((Map) objs.get("operations")).get("operation")).get(0); + CodegenOperation postProcessedOp = objs.getOperations().getOperation().get(0); CodegenParameter pp = postProcessedOp.pathParams.get(0); Assert.assertEquals(pp.vendorExtensions.get("x-ruby-example"), "'orderid123'"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeClientCodegenTest.java index d08944e269cf..dacc57d2f708 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeClientCodegenTest.java @@ -9,6 +9,8 @@ import org.openapitools.codegen.languages.TypeScriptNodeClientCodegen; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -145,20 +147,20 @@ public void mappedApiImportTest() { @Test(description = "correctly produces imports without import mapping") public void postProcessOperationsWithModelsTestWithoutImportMapping() { final String importName = "../model/pet"; - Map operations = createPostProcessOperationsMapWithImportName(importName); + OperationsMap operations = createPostProcessOperationsMapWithImportName(importName); codegen.postProcessOperationsWithModels(operations, Collections.emptyList()); - List> extractedImports = (List>) operations.get("imports"); + List> extractedImports = operations.getImports(); Assert.assertEquals(extractedImports.get(0).get("filename"), importName); } @Test(description = "correctly produces imports with import mapping") public void postProcessOperationsWithModelsTestWithImportMapping() { final String importName = "@namespace/dir/category"; - Map operations = createPostProcessOperationsMapWithImportName(importName); + OperationsMap operations = createPostProcessOperationsMapWithImportName(importName); codegen.postProcessOperationsWithModels(operations, Collections.emptyList()); - List> extractedImports = (List>) operations.get("imports"); + List> extractedImports = operations.getImports(); Assert.assertEquals(extractedImports.get(0).get("filename"), importName); } @@ -221,22 +223,22 @@ public void postProcessOperationsWithModelsTestWithModelNamePrefix() { Assert.assertEquals(tsImports.get(0).get("filename"), "./prefixChild"); } - private Map createPostProcessOperationsMapWithImportName(String importName) { - Map operations = new HashMap() {{ - put("operation", Collections.emptyList()); - put("classname", "Pet"); - }}; + private OperationsMap createPostProcessOperationsMapWithImportName(String importName) { + OperationMap operations = new OperationMap(); + operations.setClassname("Pet"); + operations.setOperation(new ArrayList<>()); - Map importList = new HashMap() {{ + Map importList = new HashMap() {{ put("import", importName); put("classname", "Pet"); }}; - List> imports = new ArrayList<>(); + List> imports = new ArrayList<>(); imports.add(importList); - return new HashMap() {{ - put("operations", operations); - put("imports", imports); - }}; + + OperationsMap operationsMap = new OperationsMap(); + operationsMap.setImports(imports); + operationsMap.setOperation(operations); + return operationsMap; } private HashMap createParameterForPostProcessAllModels(CodegenModel root, CodegenModel child) { diff --git a/modules/openapi-generator/src/test/resources/3_0/issue_9282.yaml b/modules/openapi-generator/src/test/resources/3_0/issue_9282.yaml new file mode 100644 index 000000000000..f3d9f38c778d --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/issue_9282.yaml @@ -0,0 +1,18 @@ +openapi: 3.0.0 +components: + schemas: + AdditionalPropertiesTrue: + description: additionalProperties set to true + type: object + properties: + child: + type: object + additionalProperties: true + + AdditionalPropertiesAnyType: + description: additionalProperties set to any type explicitly + type: object + properties: + child: + type: object + additionalProperties: {} diff --git a/modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml b/modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml index ec0120ca4f21..dc916b1ee21e 100644 --- a/modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml @@ -116,13 +116,15 @@ components: - $ref: '#/components/schemas/Entity' FooRef: type: object - discriminator: - propertyName: '@type' properties: foorefPropA: type: string allOf: - $ref: '#/components/schemas/EntityRef' + BarRef: + type: object + allOf: + - $ref: '#/components/schemas/EntityRef' Bar_Create: type: object properties: @@ -149,6 +151,32 @@ components: $ref: '#/components/schemas/FooRefOrValue' allOf: - $ref: '#/components/schemas/Entity' + BarRefOrValue: + type: object + oneOf: + - $ref: "#/components/schemas/Bar" + - $ref: "#/components/schemas/BarRef" + Pizza: + type: object + properties: + pizzaSize: + type: number + allOf: + - $ref: '#/components/schemas/Entity' + Pasta: + type: object + properties: + vendor: + type: string + allOf: + - $ref: '#/components/schemas/Entity' + PizzaSpeziale: + type: object + properties: + toppings: + type: string + allOf: + - $ref: '#/components/schemas/Pizza' requestBodies: Foo: diff --git a/modules/openapi-generator/src/test/resources/3_0/powershell/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/powershell/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml new file mode 100644 index 000000000000..22c23b279c62 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/powershell/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -0,0 +1,2185 @@ +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' + post: + tags: + - pet + summary: Add a new pet to the store + description: '' + operationId: addPet + responses: + '405': + description: Invalid input + security: + - http_signature_test: [] + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + $ref: '#/components/requestBodies/Pet' + put: + tags: + - pet + summary: Update an existing pet + description: '' + operationId: updatePet + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - http_signature_test: [] + - 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: + - http_signature_test: [] + - 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 + 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: + - http_signature_test: [] + - 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 + 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: + x-powershell-method-name: Remove-Pet + 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/{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 generated 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 + 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 + default: '2010-02-01T10:20:10.11111+01:00' + example: '2020-02-02T20:20:20.22222Z' + 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: Someting 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/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/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/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/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 much reference a schema named + `File`. + operationId: testBodyWithFileSchema + responses: + '200': + description: Success + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileSchemaTestClass' + 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 + 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 + 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/array-of-enums: + get: + tags: + - fake + summary: Array of Enums + operationId: getArrayOfEnums + responses: + 200: + description: Got named array of enums + content: + application/json: + schema: + $ref: '#/components/schemas/ArrayOfEnums' +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_variable + description: The local server without variables +components: + requestBodies: + UserArray: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' + examples: + simple-list: + summary: Simple list example + description: Should not get into code examples + value: + - username: foo + - username: bar + 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: + # Test the 'HTTP signature' security scheme. + # Each HTTP request is cryptographically signed as specified + # in https://datatracker.ietf.org/doc/draft-cavage-http-signatures/ + 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 + example: '2020-02-02T20:20:20.000222Z' + 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 + objectWithNoDeclaredProps: + type: object + # Note: the 'additionalProperties' keyword is not specified, which is + # equivalent to allowing undeclared properties of any type. + description: test code generation for objects + Value must be a map of strings to values. It cannot be the 'null' value. + objectWithNoDeclaredPropsNullable: + type: object + # Note: the 'additionalProperties' keyword is not specified, which is + # equivalent to allowing undeclared properties of any type. + description: test code generation for nullable objects. + Value must be a map of strings to values or the 'null' value. + nullable: true + anyTypeProp: + description: test code generation for any type + Here the 'type' attribute is not specified, which means the value can be anything, + including the null value, string, number, boolean, array or object. + See https://github.com/OAI/OpenAPI-Specification/issues/1389 + # TODO: this should be supported, currently there are some issues in the code generation. + #anyTypeExceptNullProp: + # description: any type except 'null' + # Here the 'type' attribute is not specified, which means the value can be anything, + # including the null value, string, number, boolean, array or object. + # not: + # type: 'null' + anyTypePropNullable: + description: test code generation for any type + Here the 'type' attribute is not specified, which means the value can be anything, + including the null value, string, number, boolean, array or object. + The 'nullable' attribute does not change the allowed values. + nullable: true + 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 + 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' + - $ref: '#/components/schemas/Address' + - type: object + properties: + declawed: + type: boolean + Address: + type: object + additionalProperties: + type: integer + Animal: + type: object + discriminator: + propertyName: className + 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 + multipleOf: 2 + int32: + type: integer + format: int32 + maximum: 200 + minimum: 20 + int64: + type: integer + format: int64 + number: + maximum: 543.2 + minimum: 32.1 + type: number + multipleOf: 32.5 + 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 + example: '2020-02-02' + dateTime: + type: string + format: date-time + example: '2007-12-03T10:15:30+01:00' + 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_integer_only: + type: integer + enum: + - 2 + - -2 + 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 + anytype_1: {} + map_with_undeclared_properties_anytype_1: + type: object + map_with_undeclared_properties_anytype_2: + type: object + properties: {} + map_with_undeclared_properties_anytype_3: + type: object + additionalProperties: true + empty_map: + type: object + description: an object with no declared properties and no undeclared + properties, hence it's an empty map. + additionalProperties: false + map_with_undeclared_properties_string: + 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 + 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 + OuterEnum: + nullable: true + type: string + enum: + - placed + - approved + - delivered + #OuterEnumInteger: + # type: integer + # enum: + # - 0 + # - 1 + # - 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 + 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 + '_special_model.name_': + type: string + 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 + fruit: + properties: + color: + type: string + oneOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + # Below additionalProperties is set to false to validate the use + # case when a composed schema has additionalProperties set to false. + additionalProperties: false + apple: + type: object + properties: + cultivar: + type: string + pattern: ^[a-zA-Z\s]*$ + origin: + type: string + pattern: /^[A-Z\s]*$/i + nullable: true + banana: + type: object + properties: + lengthCm: + type: number + mammal: + oneOf: + - $ref: '#/components/schemas/whale' + - $ref: '#/components/schemas/zebra' + - $ref: '#/components/schemas/Pig' + discriminator: + propertyName: className + whale: + type: object + properties: + hasBaleen: + type: boolean + hasTeeth: + type: boolean + className: + type: string + required: + - className + zebra: + type: object + properties: + type: + type: string + enum: + - plains + - mountain + - grevys + className: + type: string + required: + - className + additionalProperties: true + Pig: + oneOf: + - $ref: '#/components/schemas/BasquePig' + - $ref: '#/components/schemas/DanishPig' + discriminator: + propertyName: className + BasquePig: + type: object + properties: + className: + type: string + required: + - className + DanishPig: + type: object + properties: + className: + type: string + required: + - className + gmFruit: + properties: + color: + type: string + anyOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + additionalProperties: false + fruitReq: + oneOf: + - type: 'null' + - $ref: '#/components/schemas/appleReq' + - $ref: '#/components/schemas/bananaReq' + additionalProperties: false + appleReq: + type: object + properties: + cultivar: + type: string + mealy: + type: boolean + required: + - cultivar + additionalProperties: false + bananaReq: + type: object + properties: + lengthCm: + type: number + sweet: + type: boolean + required: + - lengthCm + additionalProperties: false + # go-experimental is unable to make Triangle and Quadrilateral models + # correctly https://github.com/OpenAPITools/openapi-generator/issues/6149 + Drawing: + type: object + properties: + mainShape: + # A property whose value is a 'oneOf' type, and the type is referenced instead + # of being defined inline. The value cannot be null. + $ref: '#/components/schemas/Shape' + shapeOrNull: + # A property whose value is a 'oneOf' type, and the type is referenced instead + # of being defined inline. The value may be null because ShapeOrNull has 'null' + # type as a child schema of 'oneOf'. + $ref: '#/components/schemas/ShapeOrNull' + nullableShape: + # A property whose value is a 'oneOf' type, and the type is referenced instead + # of being defined inline. The value may be null because NullableShape has the + # 'nullable: true' attribute. For this specific scenario this is exactly the + # same thing as 'shapeOrNull'. + $ref: '#/components/schemas/NullableShape' + shapes: + type: array + items: + $ref: '#/components/schemas/Shape' + additionalProperties: + # Here the additional properties are specified using a referenced schema. + # This is just to validate the generated code works when using $ref + # under 'additionalProperties'. + $ref: '#/components/schemas/fruit' + Shape: + oneOf: + - $ref: '#/components/schemas/Triangle' + - $ref: '#/components/schemas/Quadrilateral' + discriminator: + propertyName: shapeType + ShapeOrNull: + description: The value may be a shape or the 'null' value. + This is introduced in OAS schema >= 3.1. + oneOf: + - type: 'null' + - $ref: '#/components/schemas/Triangle' + - $ref: '#/components/schemas/Quadrilateral' + discriminator: + propertyName: shapeType + NullableShape: + description: The value may be a shape or the 'null' value. + The 'nullable' attribute was introduced in OAS schema >= 3.0 + and has been deprecated in OAS schema >= 3.1. + oneOf: + - $ref: '#/components/schemas/Triangle' + - $ref: '#/components/schemas/Quadrilateral' + discriminator: + propertyName: shapeType + nullable: true + ShapeInterface: + properties: + shapeType: + type: string + required: + - shapeType + TriangleInterface: + properties: + triangleType: + type: string + required: + - triangleType + Triangle: + oneOf: + - $ref: '#/components/schemas/EquilateralTriangle' + - $ref: '#/components/schemas/IsoscelesTriangle' + - $ref: '#/components/schemas/ScaleneTriangle' + discriminator: + propertyName: triangleType + # Note: the 'additionalProperties' keyword is not specified, which is + # equivalent to allowing undeclared properties of any type. + EquilateralTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + IsoscelesTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + additionalProperties: false + ScaleneTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + QuadrilateralInterface: + properties: + quadrilateralType: + type: string + required: + - quadrilateralType + Quadrilateral: + oneOf: + - $ref: '#/components/schemas/SimpleQuadrilateral' + - $ref: '#/components/schemas/ComplexQuadrilateral' + discriminator: + propertyName: quadrilateralType + SimpleQuadrilateral: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/QuadrilateralInterface' + ComplexQuadrilateral: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/QuadrilateralInterface' + GrandparentAnimal: + type: object + required: + - pet_type + properties: + pet_type: + type: string + discriminator: + propertyName: pet_type + ParentPet: + type: object + allOf: + - $ref: '#/components/schemas/GrandparentAnimal' + #ChildCat: + # allOf: + # - $ref: '#/components/schemas/ParentPet' + # - type: object + # properties: + # name: + # type: string + # pet_type: + # x-enum-as-string: true + # type: string + # enum: + # - ChildCat + # default: ChildCat + ArrayOfEnums: + type: array + items: + $ref: '#/components/schemas/OuterEnum' + DateTimeTest: + type: string + default: '2010-01-01T10:10:10.000111+01:00' + example: '2010-01-01T10:10:10.000111+01:00' + format: date-time + 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' + PetWithRequiredTags: + type: object + required: + - name + - photoUrls + - tags + 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 + 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 diff --git a/pom.xml b/pom.xml index c46e4824ccca..1a7ecf89b373 100644 --- a/pom.xml +++ b/pom.xml @@ -924,6 +924,18 @@ samples/openapi3/client/petstore/typescript/tests/jquery + + typescript-client-tests-browser + + + env + java + + + + samples/openapi3/client/petstore/typescript/tests/browser + + typescript-fetch-client-tests-default @@ -1205,6 +1217,8 @@ + samples/openapi3/client/petstore/typescript/builds/browser + samples/openapi3/client/petstore/typescript/tests/browser samples/client/petstore/typescript-fetch/builds/default samples/client/petstore/typescript-fetch/builds/es6-target samples/client/petstore/typescript-fetch/builds/with-npm-version @@ -1250,6 +1264,7 @@ samples/client/petstore/clojure samples/client/petstore/java/jersey2-java8 samples/openapi3/client/petstore/java/jersey2-java8 + samples/client/petstore/java/jersey3 samples/client/others/java/okhttp-gson-streaming samples/client/petstore/java/okhttp-gson @@ -1481,12 +1496,12 @@ 4.3.1 1.7.32 3.1.12.2 - 3.0.0-M5 + 3.0.0-M6 7.19.0 2.1.12 io.swagger.parser.v3 2.0.31 - 7.3.0 + 7.5 1.34 3.4.3 1.12 diff --git a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java index f607038fce9d..81d09b9e78db 100644 --- a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java @@ -993,7 +993,7 @@ public InputStream executeStream(Call call, Type returnType) throws ApiException try { Response response = call.execute(); if (!response.isSuccessful()) { - throw new ApiException(response.code(), response.message()); + throw new ApiException(response.code(), response.message(), response.headers().toMultimap(), null); } if (response.body() == null) { return null; diff --git a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SomeObj.java b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SomeObj.java index af22a72bb83d..d68460b7e209 100644 --- a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SomeObj.java +++ b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SomeObj.java @@ -317,6 +317,15 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SomeObj` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("$_type") != null && !jsonObj.get("$_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `$_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("$_type").toString())); + } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/others/typescript/builds/with-unique-items/auth/auth.ts b/samples/client/others/typescript/builds/with-unique-items/auth/auth.ts index 49340932e11b..be50274b9d65 100644 --- a/samples/client/others/typescript/builds/with-unique-items/auth/auth.ts +++ b/samples/client/others/typescript/builds/with-unique-items/auth/auth.ts @@ -1,4 +1,3 @@ -// typings for btoa are incorrect import { RequestContext } from "../http/http"; /** diff --git a/samples/client/others/typescript/builds/with-unique-items/http/http.ts b/samples/client/others/typescript/builds/with-unique-items/http/http.ts index f19e206b19ff..579326776771 100644 --- a/samples/client/others/typescript/builds/with-unique-items/http/http.ts +++ b/samples/client/others/typescript/builds/with-unique-items/http/http.ts @@ -1,5 +1,3 @@ -// typings of url-parse are incorrect... -// @ts-ignore import * as URLParse from "url-parse"; import { Observable, from } from '../rxjsStub'; diff --git a/samples/client/others/typescript/builds/with-unique-items/index.ts b/samples/client/others/typescript/builds/with-unique-items/index.ts index 127f89d99723..89069bd11889 100644 --- a/samples/client/others/typescript/builds/with-unique-items/index.ts +++ b/samples/client/others/typescript/builds/with-unique-items/index.ts @@ -5,6 +5,7 @@ export { createConfiguration } from "./configuration" export { Configuration } from "./configuration" export * from "./apis/exception"; export * from "./servers"; +export { RequiredError } from "./apis/baseapi"; export { PromiseMiddleware as Middleware } from './middleware'; export { PromiseDefaultApi as DefaultApi } from './types/PromiseAPI'; diff --git a/samples/client/others/typescript/builds/with-unique-items/package.json b/samples/client/others/typescript/builds/with-unique-items/package.json index b5bc9412dfe3..9e62e7577e7d 100644 --- a/samples/client/others/typescript/builds/with-unique-items/package.json +++ b/samples/client/others/typescript/builds/with-unique-items/package.json @@ -11,6 +11,10 @@ ], "license": "Unlicense", "main": "./dist/index.js", + "type": "commonjs", + "exports": { + ".": "./dist/index.js" + }, "typings": "./dist/index.d.ts", "scripts": { "build": "tsc", @@ -22,6 +26,7 @@ "url-parse": "^1.4.3" }, "devDependencies": { - "typescript": "^3.9.3" + "typescript": "^3.9.3", + "@types/url-parse": "1.4.4" } } diff --git a/samples/client/others/typescript/builds/with-unique-items/tsconfig.json b/samples/client/others/typescript/builds/with-unique-items/tsconfig.json index 6576215ef877..aa173eb68f32 100644 --- a/samples/client/others/typescript/builds/with-unique-items/tsconfig.json +++ b/samples/client/others/typescript/builds/with-unique-items/tsconfig.json @@ -3,7 +3,6 @@ "strict": true, /* Basic Options */ "target": "es5", - "module": "commonjs", "moduleResolution": "node", "declaration": true, diff --git a/samples/client/petstore/c/api/PetAPI.c b/samples/client/petstore/c/api/PetAPI.c index b5d6f2d61806..515146a12ba2 100644 --- a/samples/client/petstore/c/api/PetAPI.c +++ b/samples/client/petstore/c/api/PetAPI.c @@ -95,9 +95,10 @@ PetAPI_addPet(apiClient_t *apiClient, pet_t * body ) localVarBodyParameters, "POST"); - if (apiClient->response_code == 405) { - printf("%s\n","Invalid input"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 405) { + // printf("%s\n","Invalid input"); + //} //No return type end: if (apiClient->dataReceived) { @@ -174,9 +175,10 @@ PetAPI_deletePet(apiClient_t *apiClient, long petId , char * api_key ) localVarBodyParameters, "DELETE"); - if (apiClient->response_code == 400) { - printf("%s\n","Invalid pet value"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 400) { + // printf("%s\n","Invalid pet value"); + //} //No return type end: if (apiClient->dataReceived) { @@ -242,12 +244,14 @@ PetAPI_findPetsByStatus(apiClient_t *apiClient, list_t * status ) localVarBodyParameters, "GET"); - if (apiClient->response_code == 200) { - printf("%s\n","successful operation"); - } - if (apiClient->response_code == 400) { - printf("%s\n","Invalid status value"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 200) { + // printf("%s\n","successful operation"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 400) { + // printf("%s\n","Invalid status value"); + //} cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); if(!cJSON_IsArray(PetAPIlocalVarJSON)) { return 0;//nonprimitive container @@ -324,12 +328,14 @@ PetAPI_findPetsByTags(apiClient_t *apiClient, list_t * tags ) localVarBodyParameters, "GET"); - if (apiClient->response_code == 200) { - printf("%s\n","successful operation"); - } - if (apiClient->response_code == 400) { - printf("%s\n","Invalid tag value"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 200) { + // printf("%s\n","successful operation"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 400) { + // printf("%s\n","Invalid tag value"); + //} cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); if(!cJSON_IsArray(PetAPIlocalVarJSON)) { return 0;//nonprimitive container @@ -414,15 +420,18 @@ PetAPI_getPetById(apiClient_t *apiClient, long petId ) localVarBodyParameters, "GET"); - if (apiClient->response_code == 200) { - printf("%s\n","successful operation"); - } - if (apiClient->response_code == 400) { - printf("%s\n","Invalid ID supplied"); - } - if (apiClient->response_code == 404) { - printf("%s\n","Pet not found"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 200) { + // printf("%s\n","successful operation"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 400) { + // printf("%s\n","Invalid ID supplied"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 404) { + // printf("%s\n","Pet not found"); + //} //nonprimitive not container cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); pet_t *elementToReturn = pet_parseFromJSON(PetAPIlocalVarJSON); @@ -491,15 +500,18 @@ PetAPI_updatePet(apiClient_t *apiClient, pet_t * body ) localVarBodyParameters, "PUT"); - if (apiClient->response_code == 400) { - printf("%s\n","Invalid ID supplied"); - } - if (apiClient->response_code == 404) { - printf("%s\n","Pet not found"); - } - if (apiClient->response_code == 405) { - printf("%s\n","Validation exception"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 400) { + // printf("%s\n","Invalid ID supplied"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 404) { + // printf("%s\n","Pet not found"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 405) { + // printf("%s\n","Validation exception"); + //} //No return type end: if (apiClient->dataReceived) { @@ -589,9 +601,10 @@ PetAPI_updatePetWithForm(apiClient_t *apiClient, long petId , char * name , char localVarBodyParameters, "POST"); - if (apiClient->response_code == 405) { - printf("%s\n","Invalid input"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 405) { + // printf("%s\n","Invalid input"); + //} //No return type end: if (apiClient->dataReceived) { @@ -696,9 +709,10 @@ PetAPI_uploadFile(apiClient_t *apiClient, long petId , char * additionalMetadata localVarBodyParameters, "POST"); - if (apiClient->response_code == 200) { - printf("%s\n","successful operation"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 200) { + // printf("%s\n","successful operation"); + //} //nonprimitive not container cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); api_response_t *elementToReturn = api_response_parseFromJSON(PetAPIlocalVarJSON); diff --git a/samples/client/petstore/c/api/StoreAPI.c b/samples/client/petstore/c/api/StoreAPI.c index 8086a57a64c2..3208b8ae53a2 100644 --- a/samples/client/petstore/c/api/StoreAPI.c +++ b/samples/client/petstore/c/api/StoreAPI.c @@ -53,12 +53,14 @@ StoreAPI_deleteOrder(apiClient_t *apiClient, char * orderId ) localVarBodyParameters, "DELETE"); - if (apiClient->response_code == 400) { - printf("%s\n","Invalid ID supplied"); - } - if (apiClient->response_code == 404) { - printf("%s\n","Order not found"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 400) { + // printf("%s\n","Invalid ID supplied"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 404) { + // printf("%s\n","Order not found"); + //} //No return type end: if (apiClient->dataReceived) { @@ -108,9 +110,10 @@ StoreAPI_getInventory(apiClient_t *apiClient) localVarBodyParameters, "GET"); - if (apiClient->response_code == 200) { - printf("%s\n","successful operation"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 200) { + // printf("%s\n","successful operation"); + //} //primitive return type not simple cJSON *localVarJSON = cJSON_Parse(apiClient->dataReceived); cJSON *VarJSON; @@ -186,15 +189,18 @@ StoreAPI_getOrderById(apiClient_t *apiClient, long orderId ) localVarBodyParameters, "GET"); - if (apiClient->response_code == 200) { - printf("%s\n","successful operation"); - } - if (apiClient->response_code == 400) { - printf("%s\n","Invalid ID supplied"); - } - if (apiClient->response_code == 404) { - printf("%s\n","Order not found"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 200) { + // printf("%s\n","successful operation"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 400) { + // printf("%s\n","Invalid ID supplied"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 404) { + // printf("%s\n","Order not found"); + //} //nonprimitive not container cJSON *StoreAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); order_t *elementToReturn = order_parseFromJSON(StoreAPIlocalVarJSON); @@ -263,12 +269,14 @@ StoreAPI_placeOrder(apiClient_t *apiClient, order_t * body ) localVarBodyParameters, "POST"); - if (apiClient->response_code == 200) { - printf("%s\n","successful operation"); - } - if (apiClient->response_code == 400) { - printf("%s\n","Invalid Order"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 200) { + // printf("%s\n","successful operation"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 400) { + // printf("%s\n","Invalid Order"); + //} //nonprimitive not container cJSON *StoreAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); order_t *elementToReturn = order_parseFromJSON(StoreAPIlocalVarJSON); diff --git a/samples/client/petstore/c/api/UserAPI.c b/samples/client/petstore/c/api/UserAPI.c index de32d2eef0d6..dff8c0934250 100644 --- a/samples/client/petstore/c/api/UserAPI.c +++ b/samples/client/petstore/c/api/UserAPI.c @@ -52,9 +52,10 @@ UserAPI_createUser(apiClient_t *apiClient, user_t * body ) localVarBodyParameters, "POST"); - if (apiClient->response_code == 0) { - printf("%s\n","successful operation"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 0) { + // printf("%s\n","successful operation"); + //} //No return type end: if (apiClient->dataReceived) { @@ -134,9 +135,10 @@ UserAPI_createUsersWithArrayInput(apiClient_t *apiClient, list_t * body ) localVarBodyParameters, "POST"); - if (apiClient->response_code == 0) { - printf("%s\n","successful operation"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 0) { + // printf("%s\n","successful operation"); + //} //No return type end: if (apiClient->dataReceived) { @@ -224,9 +226,10 @@ UserAPI_createUsersWithListInput(apiClient_t *apiClient, list_t * body ) localVarBodyParameters, "POST"); - if (apiClient->response_code == 0) { - printf("%s\n","successful operation"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 0) { + // printf("%s\n","successful operation"); + //} //No return type end: if (apiClient->dataReceived) { @@ -297,12 +300,14 @@ UserAPI_deleteUser(apiClient_t *apiClient, char * username ) localVarBodyParameters, "DELETE"); - if (apiClient->response_code == 400) { - printf("%s\n","Invalid username supplied"); - } - if (apiClient->response_code == 404) { - printf("%s\n","User not found"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 400) { + // printf("%s\n","Invalid username supplied"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 404) { + // printf("%s\n","User not found"); + //} //No return type end: if (apiClient->dataReceived) { @@ -361,15 +366,18 @@ UserAPI_getUserByName(apiClient_t *apiClient, char * username ) localVarBodyParameters, "GET"); - if (apiClient->response_code == 200) { - printf("%s\n","successful operation"); - } - if (apiClient->response_code == 400) { - printf("%s\n","Invalid username supplied"); - } - if (apiClient->response_code == 404) { - printf("%s\n","User not found"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 200) { + // printf("%s\n","successful operation"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 400) { + // printf("%s\n","Invalid username supplied"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 404) { + // printf("%s\n","User not found"); + //} //nonprimitive not container cJSON *UserAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); user_t *elementToReturn = user_parseFromJSON(UserAPIlocalVarJSON); @@ -453,12 +461,14 @@ UserAPI_loginUser(apiClient_t *apiClient, char * username , char * password ) localVarBodyParameters, "GET"); - if (apiClient->response_code == 200) { - printf("%s\n","successful operation"); - } - if (apiClient->response_code == 400) { - printf("%s\n","Invalid username/password supplied"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 200) { + // printf("%s\n","successful operation"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 400) { + // printf("%s\n","Invalid username/password supplied"); + //} //primitive return type simple char* elementToReturn = strdup((char*)apiClient->dataReceived); @@ -533,9 +543,10 @@ UserAPI_logoutUser(apiClient_t *apiClient) localVarBodyParameters, "GET"); - if (apiClient->response_code == 0) { - printf("%s\n","successful operation"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 0) { + // printf("%s\n","successful operation"); + //} //No return type end: if (apiClient->dataReceived) { @@ -602,12 +613,14 @@ UserAPI_updateUser(apiClient_t *apiClient, char * username , user_t * body ) localVarBodyParameters, "PUT"); - if (apiClient->response_code == 400) { - printf("%s\n","Invalid user supplied"); - } - if (apiClient->response_code == 404) { - printf("%s\n","User not found"); - } + // uncomment below to debug the error response + //if (apiClient->response_code == 400) { + // printf("%s\n","Invalid user supplied"); + //} + // uncomment below to debug the error response + //if (apiClient->response_code == 404) { + // printf("%s\n","User not found"); + //} //No return type end: if (apiClient->dataReceived) { diff --git a/samples/client/petstore/java-micronaut-client/pom.xml b/samples/client/petstore/java-micronaut-client/pom.xml index 9c20a94c9478..45ce5f36ccb0 100644 --- a/samples/client/petstore/java-micronaut-client/pom.xml +++ b/samples/client/petstore/java-micronaut-client/pom.xml @@ -16,6 +16,7 @@ jar 1.8 + UTF-8 3.3.1 diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle b/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle index 7a7b8a1f2cac..b70b07ae2a39 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle @@ -100,11 +100,11 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.6.5" jackson_version = "2.13.2" - jackson_databind_version = "2.13.2" + jackson_databind_version = "2.13.2.2" jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" jersey_version = "2.35" - junit_version = "4.13.2" + junit_version = "5.8.2" scribejava_apis_version = "8.3.1" } @@ -123,7 +123,12 @@ dependencies { implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" implementation "com.github.scribejava:scribejava-apis:$scribejava_apis_version" implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +} + +test { + useJUnitPlatform() } javadoc { diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/build.sbt b/samples/client/petstore/java/jersey2-java8-localdatetime/build.sbt index 73980d667b17..6fe11cf32eca 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/build.sbt +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/build.sbt @@ -18,12 +18,11 @@ lazy val root = (project in file(".")). "org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.35", "com.fasterxml.jackson.core" % "jackson-core" % "2.13.2" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.2" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2" % "compile", - "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2.2" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.2" % "compile", "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.2" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test" + "org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test" ) ) diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/pom.xml b/samples/client/petstore/java/jersey2-java8-localdatetime/pom.xml index f83095b71576..a851a834f431 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/pom.xml +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/pom.xml @@ -341,7 +341,7 @@ 1.6.5 2.35 2.13.2 - 2.13.2 + 2.13.2.2 0.2.2 1.3.5 5.8.2 diff --git a/samples/client/petstore/java/jersey2-java8/build.gradle b/samples/client/petstore/java/jersey2-java8/build.gradle index 4d218c069797..d53694126554 100644 --- a/samples/client/petstore/java/jersey2-java8/build.gradle +++ b/samples/client/petstore/java/jersey2-java8/build.gradle @@ -100,11 +100,11 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.6.5" jackson_version = "2.13.2" - jackson_databind_version = "2.13.2" + jackson_databind_version = "2.13.2.2" jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" jersey_version = "2.35" - junit_version = "4.13.2" + junit_version = "5.8.2" scribejava_apis_version = "8.3.1" } @@ -123,7 +123,12 @@ dependencies { implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" implementation "com.github.scribejava:scribejava-apis:$scribejava_apis_version" implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +} + +test { + useJUnitPlatform() } javadoc { diff --git a/samples/client/petstore/java/jersey2-java8/build.sbt b/samples/client/petstore/java/jersey2-java8/build.sbt index bf31c54768d7..7d1e0c9a31b9 100644 --- a/samples/client/petstore/java/jersey2-java8/build.sbt +++ b/samples/client/petstore/java/jersey2-java8/build.sbt @@ -18,12 +18,11 @@ lazy val root = (project in file(".")). "org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.35", "com.fasterxml.jackson.core" % "jackson-core" % "2.13.2" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.2" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2" % "compile", - "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2.2" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.2" % "compile", "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.2" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test" + "org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test" ) ) diff --git a/samples/client/petstore/java/jersey2-java8/pom.xml b/samples/client/petstore/java/jersey2-java8/pom.xml index b5196db43718..97d990a4dc93 100644 --- a/samples/client/petstore/java/jersey2-java8/pom.xml +++ b/samples/client/petstore/java/jersey2-java8/pom.xml @@ -341,7 +341,7 @@ 1.6.5 2.35 2.13.2 - 2.13.2 + 2.13.2.2 0.2.2 1.3.5 5.8.2 diff --git a/samples/client/petstore/java/jersey3/.github/workflows/maven.yml b/samples/client/petstore/java/jersey3/.github/workflows/maven.yml new file mode 100644 index 000000000000..89fbd4999bc1 --- /dev/null +++ b/samples/client/petstore/java/jersey3/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ '8' ] + steps: + - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/jersey3/.gitignore b/samples/client/petstore/java/jersey3/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/jersey3/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/jersey3/.openapi-generator-ignore b/samples/client/petstore/java/jersey3/.openapi-generator-ignore new file mode 100644 index 000000000000..16d6986fc2e5 --- /dev/null +++ b/samples/client/petstore/java/jersey3/.openapi-generator-ignore @@ -0,0 +1,4 @@ +# OpenAPI Generator Ignore +# These are "live" test files which should not be overwritten +src/test/java/org/openapitools/client/JSONTest.java +src/test/java/org/openapitools/client/JSONComposedSchemaTest.java diff --git a/samples/client/petstore/java/jersey3/.openapi-generator/FILES b/samples/client/petstore/java/jersey3/.openapi-generator/FILES new file mode 100644 index 000000000000..d9a7d4789da6 --- /dev/null +++ b/samples/client/petstore/java/jersey3/.openapi-generator/FILES @@ -0,0 +1,201 @@ +.github/workflows/maven.yml +.gitignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/AdditionalPropertiesClass.md +docs/Animal.md +docs/AnotherFakeApi.md +docs/Apple.md +docs/AppleReq.md +docs/ArrayOfArrayOfNumberOnly.md +docs/ArrayOfNumberOnly.md +docs/ArrayTest.md +docs/Banana.md +docs/BananaReq.md +docs/BasquePig.md +docs/Capitalization.md +docs/Cat.md +docs/CatAllOf.md +docs/Category.md +docs/ChildCat.md +docs/ChildCatAllOf.md +docs/ClassModel.md +docs/Client.md +docs/ComplexQuadrilateral.md +docs/DanishPig.md +docs/DefaultApi.md +docs/DeprecatedObject.md +docs/Dog.md +docs/DogAllOf.md +docs/Drawing.md +docs/EnumArrays.md +docs/EnumClass.md +docs/EnumTest.md +docs/EquilateralTriangle.md +docs/FakeApi.md +docs/FakeClassnameTags123Api.md +docs/FileSchemaTestClass.md +docs/Foo.md +docs/FormatTest.md +docs/Fruit.md +docs/FruitReq.md +docs/GmFruit.md +docs/GrandparentAnimal.md +docs/HasOnlyReadOnly.md +docs/HealthCheckResult.md +docs/InlineResponseDefault.md +docs/IsoscelesTriangle.md +docs/Mammal.md +docs/MapTest.md +docs/MixedPropertiesAndAdditionalPropertiesClass.md +docs/Model200Response.md +docs/ModelApiResponse.md +docs/ModelFile.md +docs/ModelList.md +docs/ModelReturn.md +docs/Name.md +docs/NullableClass.md +docs/NullableShape.md +docs/NumberOnly.md +docs/ObjectWithDeprecatedFields.md +docs/Order.md +docs/OuterComposite.md +docs/OuterEnum.md +docs/OuterEnumDefaultValue.md +docs/OuterEnumInteger.md +docs/OuterEnumIntegerDefaultValue.md +docs/ParentPet.md +docs/Pet.md +docs/PetApi.md +docs/Pig.md +docs/Quadrilateral.md +docs/QuadrilateralInterface.md +docs/ReadOnlyFirst.md +docs/ScaleneTriangle.md +docs/Shape.md +docs/ShapeInterface.md +docs/ShapeOrNull.md +docs/SimpleQuadrilateral.md +docs/SpecialModelName.md +docs/StoreApi.md +docs/Tag.md +docs/Triangle.md +docs/TriangleInterface.md +docs/User.md +docs/UserApi.md +docs/Whale.md +docs/Zebra.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/JavaTimeFormatter.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/RFC3339DateFormat.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/AnotherFakeApi.java +src/main/java/org/openapitools/client/api/DefaultApi.java +src/main/java/org/openapitools/client/api/FakeApi.java +src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/Animal.java +src/main/java/org/openapitools/client/model/Apple.java +src/main/java/org/openapitools/client/model/AppleReq.java +src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayTest.java +src/main/java/org/openapitools/client/model/Banana.java +src/main/java/org/openapitools/client/model/BananaReq.java +src/main/java/org/openapitools/client/model/BasquePig.java +src/main/java/org/openapitools/client/model/Capitalization.java +src/main/java/org/openapitools/client/model/Cat.java +src/main/java/org/openapitools/client/model/CatAllOf.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ChildCat.java +src/main/java/org/openapitools/client/model/ChildCatAllOf.java +src/main/java/org/openapitools/client/model/ClassModel.java +src/main/java/org/openapitools/client/model/Client.java +src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +src/main/java/org/openapitools/client/model/DanishPig.java +src/main/java/org/openapitools/client/model/DeprecatedObject.java +src/main/java/org/openapitools/client/model/Dog.java +src/main/java/org/openapitools/client/model/DogAllOf.java +src/main/java/org/openapitools/client/model/Drawing.java +src/main/java/org/openapitools/client/model/EnumArrays.java +src/main/java/org/openapitools/client/model/EnumClass.java +src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/EquilateralTriangle.java +src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/FormatTest.java +src/main/java/org/openapitools/client/model/Fruit.java +src/main/java/org/openapitools/client/model/FruitReq.java +src/main/java/org/openapitools/client/model/GmFruit.java +src/main/java/org/openapitools/client/model/GrandparentAnimal.java +src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +src/main/java/org/openapitools/client/model/HealthCheckResult.java +src/main/java/org/openapitools/client/model/InlineResponseDefault.java +src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +src/main/java/org/openapitools/client/model/Mammal.java +src/main/java/org/openapitools/client/model/MapTest.java +src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/Model200Response.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/ModelFile.java +src/main/java/org/openapitools/client/model/ModelList.java +src/main/java/org/openapitools/client/model/ModelReturn.java +src/main/java/org/openapitools/client/model/Name.java +src/main/java/org/openapitools/client/model/NullableClass.java +src/main/java/org/openapitools/client/model/NullableShape.java +src/main/java/org/openapitools/client/model/NumberOnly.java +src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/OuterComposite.java +src/main/java/org/openapitools/client/model/OuterEnum.java +src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java +src/main/java/org/openapitools/client/model/OuterEnumInteger.java +src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java +src/main/java/org/openapitools/client/model/ParentPet.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/Pig.java +src/main/java/org/openapitools/client/model/Quadrilateral.java +src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +src/main/java/org/openapitools/client/model/ScaleneTriangle.java +src/main/java/org/openapitools/client/model/Shape.java +src/main/java/org/openapitools/client/model/ShapeInterface.java +src/main/java/org/openapitools/client/model/ShapeOrNull.java +src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +src/main/java/org/openapitools/client/model/SpecialModelName.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/Triangle.java +src/main/java/org/openapitools/client/model/TriangleInterface.java +src/main/java/org/openapitools/client/model/User.java +src/main/java/org/openapitools/client/model/Whale.java +src/main/java/org/openapitools/client/model/Zebra.java diff --git a/samples/client/petstore/java/jersey3/.openapi-generator/VERSION b/samples/client/petstore/java/jersey3/.openapi-generator/VERSION new file mode 100644 index 000000000000..5f68295fc196 --- /dev/null +++ b/samples/client/petstore/java/jersey3/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/java/jersey3/.travis.yml b/samples/client/petstore/java/jersey3/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/jersey3/.travis.yml @@ -0,0 +1,22 @@ +# +# Generated by OpenAPI Generator: https://openapi-generator.tech +# +# Ref: https://docs.travis-ci.com/user/languages/java/ +# +language: java +jdk: + - openjdk12 + - openjdk11 + - openjdk10 + - openjdk9 + - openjdk8 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + #- mvn test + # test using gradle + - gradle test + # test using sbt + # - sbt test diff --git a/samples/client/petstore/java/jersey3/README.md b/samples/client/petstore/java/jersey3/README.md new file mode 100644 index 000000000000..a03601a1c49f --- /dev/null +++ b/samples/client/petstore/java/jersey3/README.md @@ -0,0 +1,287 @@ +# petstore-jersey3 + +OpenAPI Petstore + +- API version: 1.0.0 + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + +## Requirements + +Building the API client library requires: + +1. Java 1.8+ +2. Maven/Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-jersey3 + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-jersey3' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-jersey3' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-jersey3:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +- `target/petstore-jersey3-1.0.0.jar` +- `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import org.openapitools.client.*; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class AnotherFakeApiExample { + + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +*DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo | +*FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +*FakeApi* | [**getArrayOfEnums**](docs/FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | +*FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | +*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model +*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | +*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [Animal](docs/Animal.md) + - [Apple](docs/Apple.md) + - [AppleReq](docs/AppleReq.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayTest](docs/ArrayTest.md) + - [Banana](docs/Banana.md) + - [BananaReq](docs/BananaReq.md) + - [BasquePig](docs/BasquePig.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [CatAllOf](docs/CatAllOf.md) + - [Category](docs/Category.md) + - [ChildCat](docs/ChildCat.md) + - [ChildCatAllOf](docs/ChildCatAllOf.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [ComplexQuadrilateral](docs/ComplexQuadrilateral.md) + - [DanishPig](docs/DanishPig.md) + - [DeprecatedObject](docs/DeprecatedObject.md) + - [Dog](docs/Dog.md) + - [DogAllOf](docs/DogAllOf.md) + - [Drawing](docs/Drawing.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumTest](docs/EnumTest.md) + - [EquilateralTriangle](docs/EquilateralTriangle.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [Foo](docs/Foo.md) + - [FormatTest](docs/FormatTest.md) + - [Fruit](docs/Fruit.md) + - [FruitReq](docs/FruitReq.md) + - [GmFruit](docs/GmFruit.md) + - [GrandparentAnimal](docs/GrandparentAnimal.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [HealthCheckResult](docs/HealthCheckResult.md) + - [InlineResponseDefault](docs/InlineResponseDefault.md) + - [IsoscelesTriangle](docs/IsoscelesTriangle.md) + - [Mammal](docs/Mammal.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [ModelFile](docs/ModelFile.md) + - [ModelList](docs/ModelList.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [NullableClass](docs/NullableClass.md) + - [NullableShape](docs/NullableShape.md) + - [NumberOnly](docs/NumberOnly.md) + - [ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md) + - [OuterEnumInteger](docs/OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) + - [ParentPet](docs/ParentPet.md) + - [Pet](docs/Pet.md) + - [Pig](docs/Pig.md) + - [Quadrilateral](docs/Quadrilateral.md) + - [QuadrilateralInterface](docs/QuadrilateralInterface.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [ScaleneTriangle](docs/ScaleneTriangle.md) + - [Shape](docs/Shape.md) + - [ShapeInterface](docs/ShapeInterface.md) + - [ShapeOrNull](docs/ShapeOrNull.md) + - [SimpleQuadrilateral](docs/SimpleQuadrilateral.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [Triangle](docs/Triangle.md) + - [TriangleInterface](docs/TriangleInterface.md) + - [User](docs/User.md) + - [Whale](docs/Whale.md) + - [Zebra](docs/Zebra.md) + + +## Documentation for Authorization + +Authentication schemes defined for the API: +### api_key + + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +### api_key_query + + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + +### bearer_test + + +- **Type**: HTTP basic authentication + +### http_basic_test + + +- **Type**: HTTP basic authentication + +### http_signature_test + + +- **Type**: HTTP basic authentication + +### petstore_auth + + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/jersey3/api/openapi.yaml b/samples/client/petstore/java/jersey3/api/openapi.yaml new file mode 100644 index 000000000000..6e508514df84 --- /dev/null +++ b/samples/client/petstore/java/jersey3/api/openapi.yaml @@ -0,0 +1,2493 @@ +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:\ + \ \" \\" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- 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_variable +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_default' + description: response + x-accepts: application/json + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + "405": + description: Invalid input + security: + - http_signature_test: [] + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: application/json + put: + description: "" + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - http_signature_test: [] + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: application/json + servers: + - url: http://petstore.swagger.io/v2 + - url: http://path-server-test.petstore.local/v2 + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + "400": + description: Invalid status value + security: + - http_signature_test: [] + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: application/json + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - http_signature_test: [] + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: application/json + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - 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: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: application/json + get: + description: Returns a single pet + 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: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: application/json + 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: + $ref: '#/components/requestBodies/inline_object' + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: application/json + /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: + $ref: '#/components/requestBodies/inline_object_1' + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: application/json + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + 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": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generated exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: application/json + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: application/json + /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: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + 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": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: application/json + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + 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": + description: Invalid username supplied + "404": + description: User not found + summary: Delete user + tags: + - user + x-accepts: application/json + 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: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: application/json + put: + description: This can only be done by the logged in user. + 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": + description: Invalid user supplied + "404": + description: User not found + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: application/json + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-content-type: application/json + x-accepts: application/json + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + 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": + description: Someting wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + x-accepts: application/json + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + default: -efg + enum: + - _abc + - -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 + requestBody: + $ref: '#/components/requestBodies/inline_object_2' + content: + application/x-www-form-urlencoded: + schema: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + responses: + "400": + description: Invalid request + "404": + description: Not found + summary: To test enum parameters + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: application/json + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + x-content-type: application/json + x-accepts: application/json + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + $ref: '#/components/requestBodies/inline_object_3' + content: + application/x-www-form-urlencoded: + schema: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: "/[a-z]/i" + type: string + pattern_without_delimiter: + description: None + pattern: "^[A-Z].*" + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + default: 2010-02-01T10:20:10.11111+01:00 + description: None + example: 2020-02-02T20:20:20.22222Z + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: application/json + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake + x-content-type: application/json + x-accepts: '*/*' + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake + x-content-type: application/json + x-accepts: '*/*' + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake + x-content-type: application/json + x-accepts: '*/*' + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake + x-content-type: application/json + x-accepts: '*/*' + /fake/jsonFormData: + get: + description: "" + operationId: testJsonFormData + requestBody: + $ref: '#/components/requestBodies/inline_object_4' + content: + application/x-www-form-urlencoded: + schema: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + responses: + "200": + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: application/json + /fake/inline-additionalProperties: + post: + description: "" + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: application/json + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - explode: true + in: query + name: query + required: true + schema: + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: application/json + /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: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-content-type: application/json + x-accepts: application/json + /fake/body-with-file-schema: + put: + description: "For this test, the body for this request much reference a schema\ + \ named `File`." + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileSchemaTestClass' + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: application/json + /fake/test-query-parameters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: true + in: query + name: pipe + required: true + schema: + items: + type: string + type: array + style: form + - explode: false + in: query + name: ioutil + required: true + schema: + items: + type: string + type: array + style: form + - explode: false + in: query + name: http + required: true + schema: + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + description: Success + tags: + - fake + x-accepts: application/json + /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: + $ref: '#/components/requestBodies/inline_object_5' + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-content-type: multipart/form-data + x-accepts: application/json + /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 + /fake/array-of-enums: + get: + operationId: getArrayOfEnums + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ArrayOfEnums' + description: Got named array of enums + summary: Array of Enums + tags: + - fake + x-accepts: application/json +components: + requestBodies: + UserArray: + content: + application/json: + examples: + simple-list: + description: Should not get into code examples + summary: Simple list example + value: + - username: foo + - username: bar + 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 + inline_object: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object' + inline_object_1: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_1' + inline_object_2: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_2' + inline_object_3: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_3' + inline_object_4: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_4' + inline_object_5: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_5' + schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2020-02-02T20:20:20.000222Z + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + example: 2020-02-02T20:20:20.000222Z + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + name: default-name + id: 6 + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + objectWithNoDeclaredPropsNullable: "{}" + phone: phone + objectWithNoDeclaredProps: "{}" + id: 0 + anyTypePropNullable: "" + email: email + anyTypeProp: "" + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + objectWithNoDeclaredProps: + description: test code generation for objects Value must be a map of strings + to values. It cannot be the 'null' value. + type: object + objectWithNoDeclaredPropsNullable: + description: test code generation for nullable objects. Value must be a + map of strings to values or the 'null' value. + nullable: true + type: object + anyTypeProp: + description: "test code generation for any type Here the 'type' attribute\ + \ is not specified, which means the value can be anything, including the\ + \ null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389" + anyTypePropNullable: + description: "test code generation for any type Here the 'type' attribute\ + \ is not specified, which means the value can be anything, including the\ + \ null value, string, number, boolean, array or object. The 'nullable'\ + \ attribute does not change the allowed values." + nullable: true + type: object + xml: + name: User + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: default-name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + "123Number": + readOnly: true + type: integer + required: + - name + xml: + name: Name + "200_response": + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + 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' + - $ref: '#/components/schemas/Dog_allOf' + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Address' + - $ref: '#/components/schemas/Cat_allOf' + Address: + additionalProperties: + type: integer + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + format_test: + properties: + integer: + maximum: 100 + minimum: 10 + multipleOf: 2 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + multipleOf: 32.5 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + decimal: + format: number + type: string + string: + pattern: "/[a-z]/i" + type: string + byte: + format: byte + type: string + binary: + format: binary + type: string + date: + example: 2020-02-02 + format: date + type: string + dateTime: + example: 2007-12-03T10:15:30+01:00 + format: date-time + type: string + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + 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 + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_integer_only: + enum: + - 2 + - -2 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + 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_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + anytype_1: {} + map_with_undeclared_properties_anytype_1: + type: object + map_with_undeclared_properties_anytype_2: + properties: {} + type: object + map_with_undeclared_properties_anytype_3: + additionalProperties: true + type: object + empty_map: + additionalProperties: false + description: "an object with no declared properties and no undeclared properties,\ + \ hence it's an empty map." + type: object + map_with_undeclared_properties_string: + additionalProperties: + type: string + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + type: object + List: + properties: + "123-list": + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + 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 + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + type: object + ArrayTest: + properties: + array_of_string: + items: + type: string + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: '#/components/schemas/ReadOnlyFirst' + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + nullable: true + type: string + OuterEnumInteger: + enum: + - 0 + - 1 + - 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 + my_number: 0.8008281904610115 + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: '#/components/schemas/File' + files: + items: + $ref: '#/components/schemas/File' + type: array + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + _special_model.name_: + type: string + 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: + NullableMessage: + nullable: true + type: string + type: object + NullableClass: + additionalProperties: + nullable: true + type: object + properties: + integer_prop: + nullable: true + type: integer + number_prop: + nullable: true + type: number + boolean_prop: + nullable: true + type: boolean + string_prop: + nullable: true + type: string + date_prop: + format: date + nullable: true + type: string + datetime_prop: + format: date-time + nullable: true + type: string + array_nullable_prop: + items: + type: object + nullable: true + type: array + array_and_items_nullable_prop: + items: + nullable: true + type: object + nullable: true + type: array + array_items_nullable: + items: + nullable: true + type: object + type: array + 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 + fruit: + additionalProperties: false + oneOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + properties: + color: + type: string + apple: + nullable: true + properties: + cultivar: + pattern: "^[a-zA-Z\\s]*$" + type: string + origin: + pattern: "/^[A-Z\\s]*$/i" + type: string + type: object + banana: + properties: + lengthCm: + type: number + type: object + mammal: + discriminator: + propertyName: className + oneOf: + - $ref: '#/components/schemas/whale' + - $ref: '#/components/schemas/zebra' + - $ref: '#/components/schemas/Pig' + whale: + properties: + hasBaleen: + type: boolean + hasTeeth: + type: boolean + className: + type: string + required: + - className + type: object + zebra: + additionalProperties: true + properties: + type: + enum: + - plains + - mountain + - grevys + type: string + className: + type: string + required: + - className + type: object + Pig: + discriminator: + propertyName: className + oneOf: + - $ref: '#/components/schemas/BasquePig' + - $ref: '#/components/schemas/DanishPig' + BasquePig: + properties: + className: + type: string + required: + - className + type: object + DanishPig: + properties: + className: + type: string + required: + - className + type: object + gmFruit: + additionalProperties: false + anyOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + properties: + color: + type: string + fruitReq: + additionalProperties: false + oneOf: + - type: "null" + - $ref: '#/components/schemas/appleReq' + - $ref: '#/components/schemas/bananaReq' + appleReq: + additionalProperties: false + properties: + cultivar: + type: string + mealy: + type: boolean + required: + - cultivar + type: object + bananaReq: + additionalProperties: false + properties: + lengthCm: + type: number + sweet: + type: boolean + required: + - lengthCm + type: object + Drawing: + additionalProperties: + $ref: '#/components/schemas/fruit' + properties: + mainShape: + $ref: '#/components/schemas/Shape' + shapeOrNull: + $ref: '#/components/schemas/ShapeOrNull' + nullableShape: + $ref: '#/components/schemas/NullableShape' + shapes: + items: + $ref: '#/components/schemas/Shape' + type: array + type: object + Shape: + discriminator: + propertyName: shapeType + oneOf: + - $ref: '#/components/schemas/Triangle' + - $ref: '#/components/schemas/Quadrilateral' + ShapeOrNull: + description: The value may be a shape or the 'null' value. This is introduced + in OAS schema >= 3.1. + discriminator: + propertyName: shapeType + oneOf: + - type: "null" + - $ref: '#/components/schemas/Triangle' + - $ref: '#/components/schemas/Quadrilateral' + NullableShape: + description: The value may be a shape or the 'null' value. The 'nullable' attribute + was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema + >= 3.1. + discriminator: + propertyName: shapeType + nullable: true + oneOf: + - $ref: '#/components/schemas/Triangle' + - $ref: '#/components/schemas/Quadrilateral' + ShapeInterface: + properties: + shapeType: + type: string + required: + - shapeType + TriangleInterface: + properties: + triangleType: + type: string + required: + - triangleType + Triangle: + discriminator: + propertyName: triangleType + oneOf: + - $ref: '#/components/schemas/EquilateralTriangle' + - $ref: '#/components/schemas/IsoscelesTriangle' + - $ref: '#/components/schemas/ScaleneTriangle' + EquilateralTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + IsoscelesTriangle: + additionalProperties: false + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + ScaleneTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + QuadrilateralInterface: + properties: + quadrilateralType: + type: string + required: + - quadrilateralType + Quadrilateral: + discriminator: + propertyName: quadrilateralType + oneOf: + - $ref: '#/components/schemas/SimpleQuadrilateral' + - $ref: '#/components/schemas/ComplexQuadrilateral' + SimpleQuadrilateral: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/QuadrilateralInterface' + ComplexQuadrilateral: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/QuadrilateralInterface' + GrandparentAnimal: + discriminator: + propertyName: pet_type + properties: + pet_type: + type: string + required: + - pet_type + type: object + ParentPet: + allOf: + - $ref: '#/components/schemas/GrandparentAnimal' + type: object + ChildCat: + allOf: + - $ref: '#/components/schemas/ParentPet' + - $ref: '#/components/schemas/ChildCat_allOf' + ArrayOfEnums: + items: + $ref: '#/components/schemas/OuterEnum' + type: array + DateTimeTest: + default: 2010-01-01T10:10:10.000111+01:00 + example: 2010-01-01T10:10:10.000111+01:00 + format: date-time + type: string + DeprecatedObject: + deprecated: true + properties: + name: + type: string + type: object + ObjectWithDeprecatedFields: + properties: + uuid: + type: string + id: + deprecated: true + type: number + deprecatedRef: + $ref: '#/components/schemas/DeprecatedObject' + bars: + deprecated: true + items: + $ref: '#/components/schemas/Bar' + type: array + type: object + inline_response_default: + example: + string: + bar: bar + properties: + string: + $ref: '#/components/schemas/Foo' + type: object + inline_object: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + inline_object_1: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + inline_object_2: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + inline_object_3: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: "/[a-z]/i" + type: string + pattern_without_delimiter: + description: None + pattern: "^[A-Z].*" + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + default: 2010-02-01T10:20:10.11111+01:00 + description: None + example: 2020-02-02T20:20:20.22222Z + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + inline_object_4: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + inline_object_5: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + Dog_allOf: + properties: + breed: + type: string + type: object + Cat_allOf: + properties: + declawed: + type: boolean + type: object + ChildCat_allOf: + properties: + name: + type: string + pet_type: + default: ChildCat + enum: + - ChildCat + type: string + x-enum-as-string: true + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http + http_signature_test: + scheme: signature + type: http + diff --git a/samples/client/petstore/java/jersey3/build.gradle b/samples/client/petstore/java/jersey3/build.gradle new file mode 100644 index 000000000000..d0be177a0eb5 --- /dev/null +++ b/samples/client/petstore/java/jersey3/build.gradle @@ -0,0 +1,162 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'com.diffplug.spotless' + +group = 'org.openapitools' +version = '1.0.0' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.3.0' + } +} + +repositories { + mavenCentral() +} + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven-publish' + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-jersey3' + + from components.java + } + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + swagger_annotations_version = "1.6.5" + jackson_version = "2.13.2" + jackson_databind_version = "2.13.2" + jackson_databind_nullable_version = "0.2.2" + jakarta_annotation_version = "2.1.0" + jersey_version = "3.0.4" + junit_version = "5.8.2" + scribejava_apis_version = "8.3.1" + tomitribe_http_signatures_version = "1.7" +} + +dependencies { + implementation "io.swagger:swagger-annotations:$swagger_annotations_version" + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "org.glassfish.jersey.core:jersey-client:$jersey_version" + implementation "org.glassfish.jersey.inject:jersey-hk2:$jersey_version" + implementation "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version" + implementation "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" + implementation "org.glassfish.jersey.connectors:jersey-apache-connector:$jersey_version" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" + implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + implementation "com.github.scribejava:scribejava-apis:$scribejava_apis_version" + implementation "org.tomitribe:tomitribe-http-signatures:$tomitribe_http_signatures_version" + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +} + +test { + useJUnitPlatform() +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + java { + // don't need to set target, it is inferred from java + // apply a specific flavor of google-java-format + googleJavaFormat('1.8').aosp().reflowLongStrings() + removeUnusedImports() + importOrder() + } +} diff --git a/samples/client/petstore/java/jersey3/build.sbt b/samples/client/petstore/java/jersey3/build.sbt new file mode 100644 index 000000000000..02d8f9eb294b --- /dev/null +++ b/samples/client/petstore/java/jersey3/build.sbt @@ -0,0 +1,29 @@ +lazy val root = (project in file(".")). + settings( + organization := "org.openapitools", + name := "petstore-jersey3", + version := "1.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + Compile / javacOptions ++= Seq("-Xlint:deprecation"), + Compile / packageDoc / publishArtifact := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "com.google.code.findbugs" % "jsr305" % "3.0.0", + "io.swagger" % "swagger-annotations" % "1.6.5", + "org.glassfish.jersey.core" % "jersey-client" % "3.0.4", + "org.glassfish.jersey.inject" % "jersey-hk2" % "3.0.4", + "org.glassfish.jersey.media" % "jersey-media-multipart" % "3.0.4", + "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "3.0.4", + "org.glassfish.jersey.connectors" % "jersey-apache-connector" % "3.0.4", + "com.fasterxml.jackson.core" % "jackson-core" % "2.13.2" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.2" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", + "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", + "org.tomitribe" % "tomitribe-http-signatures" % "1.7" % "compile", + "jakarta.annotation" % "jakarta.annotation-api" % "2.1.0" % "compile", + "org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test" + ) + ) diff --git a/samples/client/petstore/java/jersey3/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/jersey3/docs/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..83051d9be44b --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/AdditionalPropertiesClass.md @@ -0,0 +1,20 @@ + + +# AdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapProperty** | **Map<String, String>** | | [optional] | +|**mapOfMapProperty** | **Map<String, Map<String, String>>** | | [optional] | +|**anytype1** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype3** | **Map<String, Object>** | | [optional] | +|**emptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] | +|**mapWithUndeclaredPropertiesString** | **Map<String, String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Animal.md b/samples/client/petstore/java/jersey3/docs/Animal.md new file mode 100644 index 000000000000..d9b32f14c88a --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Animal.md @@ -0,0 +1,14 @@ + + +# Animal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | +|**color** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/AnotherFakeApi.md b/samples/client/petstore/java/jersey3/docs/AnotherFakeApi.md new file mode 100644 index 000000000000..3cd7cd99f71f --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/AnotherFakeApi.md @@ -0,0 +1,74 @@ +# AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags | + + + +## call123testSpecialTags + +> Client call123testSpecialTags(client) + +To test special tags + +To test special tags and operation ID starting with number + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey3/docs/Apple.md b/samples/client/petstore/java/jersey3/docs/Apple.md new file mode 100644 index 000000000000..0ef7a92c74d6 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Apple.md @@ -0,0 +1,14 @@ + + +# Apple + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | [optional] | +|**origin** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/AppleReq.md b/samples/client/petstore/java/jersey3/docs/AppleReq.md new file mode 100644 index 000000000000..989e1cfedd1e --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/AppleReq.md @@ -0,0 +1,14 @@ + + +# AppleReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | | +|**mealy** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/jersey3/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..0188db3eb131 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayArrayNumber** | **List<List<BigDecimal>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/jersey3/docs/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..a5753530aada --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayNumber** | **List<BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ArrayTest.md b/samples/client/petstore/java/jersey3/docs/ArrayTest.md new file mode 100644 index 000000000000..36077c9df300 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ArrayTest.md @@ -0,0 +1,15 @@ + + +# ArrayTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayOfString** | **List<String>** | | [optional] | +|**arrayArrayOfInteger** | **List<List<Long>>** | | [optional] | +|**arrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Banana.md b/samples/client/petstore/java/jersey3/docs/Banana.md new file mode 100644 index 000000000000..5356d17ee700 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Banana.md @@ -0,0 +1,13 @@ + + +# Banana + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**lengthCm** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/BananaReq.md b/samples/client/petstore/java/jersey3/docs/BananaReq.md new file mode 100644 index 000000000000..22ebe1a7105f --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/BananaReq.md @@ -0,0 +1,14 @@ + + +# BananaReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**lengthCm** | **BigDecimal** | | | +|**sweet** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/BasquePig.md b/samples/client/petstore/java/jersey3/docs/BasquePig.md new file mode 100644 index 000000000000..160cb71c321f --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/BasquePig.md @@ -0,0 +1,13 @@ + + +# BasquePig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Capitalization.md b/samples/client/petstore/java/jersey3/docs/Capitalization.md new file mode 100644 index 000000000000..82a812711de2 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Capitalization.md @@ -0,0 +1,18 @@ + + +# Capitalization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**smallCamel** | **String** | | [optional] | +|**capitalCamel** | **String** | | [optional] | +|**smallSnake** | **String** | | [optional] | +|**capitalSnake** | **String** | | [optional] | +|**scAETHFlowPoints** | **String** | | [optional] | +|**ATT_NAME** | **String** | Name of the pet | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Cat.md b/samples/client/petstore/java/jersey3/docs/Cat.md new file mode 100644 index 000000000000..390dd519c8ce --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Cat.md @@ -0,0 +1,13 @@ + + +# Cat + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**declawed** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/CatAllOf.md b/samples/client/petstore/java/jersey3/docs/CatAllOf.md new file mode 100644 index 000000000000..926bc0abd78f --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/CatAllOf.md @@ -0,0 +1,13 @@ + + +# CatAllOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**declawed** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Category.md b/samples/client/petstore/java/jersey3/docs/Category.md new file mode 100644 index 000000000000..ab6d1ec334dc --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Category.md @@ -0,0 +1,14 @@ + + +# Category + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ChildCat.md b/samples/client/petstore/java/jersey3/docs/ChildCat.md new file mode 100644 index 000000000000..6a114cc4ffb3 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ChildCat.md @@ -0,0 +1,22 @@ + + +# ChildCat + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**petType** | [**String**](#String) | | | + + + +## Enum: String + +| Name | Value | +|---- | -----| +| CHILDCAT | "ChildCat" | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ChildCatAllOf.md b/samples/client/petstore/java/jersey3/docs/ChildCatAllOf.md new file mode 100644 index 000000000000..35fac5c5f09f --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ChildCatAllOf.md @@ -0,0 +1,22 @@ + + +# ChildCatAllOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**petType** | [**String**](#String) | | [optional] | + + + +## Enum: String + +| Name | Value | +|---- | -----| +| CHILDCAT | "ChildCat" | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ClassModel.md b/samples/client/petstore/java/jersey3/docs/ClassModel.md new file mode 100644 index 000000000000..af46dea1f6c8 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ClassModel.md @@ -0,0 +1,14 @@ + + +# ClassModel + +Model for testing model with \"_class\" property + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Client.md b/samples/client/petstore/java/jersey3/docs/Client.md new file mode 100644 index 000000000000..ef07b4ab8b9d --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Client.md @@ -0,0 +1,13 @@ + + +# Client + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**client** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ComplexQuadrilateral.md b/samples/client/petstore/java/jersey3/docs/ComplexQuadrilateral.md new file mode 100644 index 000000000000..d0a4b1a0a758 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ComplexQuadrilateral.md @@ -0,0 +1,14 @@ + + +# ComplexQuadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/jersey3/docs/DanishPig.md b/samples/client/petstore/java/jersey3/docs/DanishPig.md new file mode 100644 index 000000000000..0b366d3cf2ff --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/DanishPig.md @@ -0,0 +1,13 @@ + + +# DanishPig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/jersey3/docs/DefaultApi.md b/samples/client/petstore/java/jersey3/docs/DefaultApi.md new file mode 100644 index 000000000000..00a8ac2ac24d --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/DefaultApi.md @@ -0,0 +1,68 @@ +# DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | | + + + +## fooGet + +> InlineResponseDefault fooGet() + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + InlineResponseDefault result = apiInstance.fooGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fooGet"); + 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 + +[**InlineResponseDefault**](InlineResponseDefault.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + diff --git a/samples/client/petstore/java/jersey3/docs/DeprecatedObject.md b/samples/client/petstore/java/jersey3/docs/DeprecatedObject.md new file mode 100644 index 000000000000..48de1d624425 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/DeprecatedObject.md @@ -0,0 +1,13 @@ + + +# DeprecatedObject + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Dog.md b/samples/client/petstore/java/jersey3/docs/Dog.md new file mode 100644 index 000000000000..972c981c0d05 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Dog.md @@ -0,0 +1,13 @@ + + +# Dog + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/DogAllOf.md b/samples/client/petstore/java/jersey3/docs/DogAllOf.md new file mode 100644 index 000000000000..d4e4ea0d548c --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/DogAllOf.md @@ -0,0 +1,13 @@ + + +# DogAllOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Drawing.md b/samples/client/petstore/java/jersey3/docs/Drawing.md new file mode 100644 index 000000000000..6b815fc4131b --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Drawing.md @@ -0,0 +1,16 @@ + + +# Drawing + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mainShape** | [**Shape**](Shape.md) | | [optional] | +|**shapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] | +|**nullableShape** | [**NullableShape**](NullableShape.md) | | [optional] | +|**shapes** | [**List<Shape>**](Shape.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/EnumArrays.md b/samples/client/petstore/java/jersey3/docs/EnumArrays.md new file mode 100644 index 000000000000..b2222d5beb25 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/EnumArrays.md @@ -0,0 +1,32 @@ + + +# EnumArrays + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] | +|**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] | + + + +## Enum: JustSymbolEnum + +| Name | Value | +|---- | -----| +| GREATER_THAN_OR_EQUAL_TO | ">=" | +| DOLLAR | "$" | + + + +## Enum: List<ArrayEnumEnum> + +| Name | Value | +|---- | -----| +| FISH | "fish" | +| CRAB | "crab" | + + + diff --git a/samples/client/petstore/java/jersey3/docs/EnumClass.md b/samples/client/petstore/java/jersey3/docs/EnumClass.md new file mode 100644 index 000000000000..b314590a7591 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/EnumClass.md @@ -0,0 +1,15 @@ + + +# EnumClass + +## Enum + + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + + + diff --git a/samples/client/petstore/java/jersey3/docs/EnumTest.md b/samples/client/petstore/java/jersey3/docs/EnumTest.md new file mode 100644 index 000000000000..3e226e18b50b --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/EnumTest.md @@ -0,0 +1,68 @@ + + +# EnumTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] | +|**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | | +|**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] | +|**enumIntegerOnly** | [**EnumIntegerOnlyEnum**](#EnumIntegerOnlyEnum) | | [optional] | +|**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] | +|**outerEnum** | **OuterEnum** | | [optional] | +|**outerEnumInteger** | **OuterEnumInteger** | | [optional] | +|**outerEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] | +|**outerEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] | + + + +## Enum: EnumStringEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumStringRequiredEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumIntegerEnum + +| Name | Value | +|---- | -----| +| NUMBER_1 | 1 | +| NUMBER_MINUS_1 | -1 | + + + +## Enum: EnumIntegerOnlyEnum + +| Name | Value | +|---- | -----| +| NUMBER_2 | 2 | +| NUMBER_MINUS_2 | -2 | + + + +## Enum: EnumNumberEnum + +| Name | Value | +|---- | -----| +| NUMBER_1_DOT_1 | 1.1 | +| NUMBER_MINUS_1_DOT_2 | -1.2 | + + + diff --git a/samples/client/petstore/java/jersey3/docs/EquilateralTriangle.md b/samples/client/petstore/java/jersey3/docs/EquilateralTriangle.md new file mode 100644 index 000000000000..eade817feb3e --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/EquilateralTriangle.md @@ -0,0 +1,14 @@ + + +# EquilateralTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/jersey3/docs/FakeApi.md b/samples/client/petstore/java/jersey3/docs/FakeApi.md new file mode 100644 index 000000000000..00365edeae97 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/FakeApi.md @@ -0,0 +1,1067 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint | +| [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | +| [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | | +| [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | | +| [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | | +| [**getArrayOfEnums**](FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums | +| [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | | +| [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | | +| [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model | +| [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 | +| [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters | +| [**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) | +| [**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties | +| [**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data | +| [**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | | + + + +## fakeHealthGet + +> HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + HealthCheckResult result = apiInstance.fakeHealthGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeHealthGet"); + 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 + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | The instance started successfully | - | + + +## fakeOuterBooleanSerialize + +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **Boolean**| Input boolean as post body | [optional] | + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + + +## fakeOuterCompositeSerialize + +> OuterComposite fakeOuterCompositeSerialize(outerComposite) + + + +Test serialization of object with outer number type + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(outerComposite); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] | + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + + +## fakeOuterNumberSerialize + +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example + +```java +import java.math.BigDecimal; +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **BigDecimal**| Input number as post body | [optional] | + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + + +## fakeOuterStringSerialize + +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **String**| Input string as post body | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + + +## getArrayOfEnums + +> List<OuterEnum> getArrayOfEnums() + +Array of Enums + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + List result = apiInstance.getArrayOfEnums(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getArrayOfEnums"); + 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 + +[**List<OuterEnum>**](OuterEnum.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Got named array of enums | - | + + +## testBodyWithFileSchema + +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(fileSchemaTestClass); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +## testBodyWithQueryParams + +> testBodyWithQueryParams(query, user) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User user = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, user); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **query** | **String**| | | +| **user** | [**User**](User.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +## testClientModel + +> Client testClientModel(client) + +To test \"client\" model + +To test "client" model + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testEndpointParameters + +> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters +假端點 +偽のエンドポイント +가짜 엔드 포인트 + + +### Example + +```java +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(78); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = LocalDate.now(); // LocalDate | None + OffsetDateTime dateTime = OffsetDateTime.parse("2010-02-01T10:20:10.111110+01:00"); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **number** | **BigDecimal**| None | | +| **_double** | **Double**| None | | +| **patternWithoutDelimiter** | **String**| None | | +| **_byte** | **byte[]**| None | | +| **integer** | **Integer**| None | [optional] | +| **int32** | **Integer**| None | [optional] | +| **int64** | **Long**| None | [optional] | +| **_float** | **Float**| None | [optional] | +| **string** | **String**| None | [optional] | +| **binary** | **File**| None | [optional] | +| **date** | **LocalDate**| None | [optional] | +| **dateTime** | **OffsetDateTime**| None | [optional] [default to 2010-02-01T10:20:10.111110+01:00] | +| **password** | **String**| None | [optional] | +| **paramCallback** | **String**| None | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## testEnumParameters + +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "_abc"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "_abc"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 1; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 1.1D; // Double | Query parameter enum test (double) + List enumFormStringArray = Arrays.asList("$"); // List | Form parameter enum test (string array) + String enumFormString = "_abc"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **enumHeaderStringArray** | **List<String>**| Header parameter enum test (string array) | [optional] [enum: >, $] | +| **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryStringArray** | **List<String>**| Query parameter enum test (string array) | [optional] [enum: >, $] | +| **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] | +| **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] | +| **enumFormStringArray** | **List<String>**| Form parameter enum test (string array) | [optional] [enum: >, $] | +| **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + + +## testGroupParameters + +> testGroupParameters().requiredStringGroup(requiredStringGroup).requiredBooleanGroup(requiredBooleanGroup).requiredInt64Group(requiredInt64Group).stringGroup(stringGroup).booleanGroup(booleanGroup).int64Group(int64Group).execute(); + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP bearer authorization: bearer_test + HttpBearerAuth bearer_test = (HttpBearerAuth) defaultClient.getAuthentication("bearer_test"); + bearer_test.setBearerToken("BEARER TOKEN"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + api.testGroupParameters() + .requiredStringGroup(requiredStringGroup) + .requiredBooleanGroup(requiredBooleanGroup) + .requiredInt64Group(requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requiredStringGroup** | **Integer**| Required String in group parameters | | +| **requiredBooleanGroup** | **Boolean**| Required Boolean in group parameters | | +| **requiredInt64Group** | **Long**| Required Integer in group parameters | | +| **stringGroup** | **Integer**| String in group parameters | [optional] | +| **booleanGroup** | **Boolean**| Boolean in group parameters | [optional] | +| **int64Group** | **Long**| Integer in group parameters | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + + +## testInlineAdditionalProperties + +> testInlineAdditionalProperties(requestBody) + +test inline additionalProperties + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Map requestBody = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | **Map<String,String>**| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testJsonFormData + +> testJsonFormData(param, param2) + +test json serialization of form data + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **param** | **String**| field1 | | +| **param2** | **String**| field2 | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testQueryParameterCollectionFormat + +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + + +To test the collection format in query parameters + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + List pipe = Arrays.asList(); // List | + List ioutil = Arrays.asList(); // List | + List http = Arrays.asList(); // List | + List url = Arrays.asList(); // List | + List context = Arrays.asList(); // List | + try { + apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pipe** | **List<String>**| | | +| **ioutil** | **List<String>**| | | +| **http** | **List<String>**| | | +| **url** | **List<String>**| | | +| **context** | **List<String>**| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + diff --git a/samples/client/petstore/java/jersey3/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/jersey3/docs/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..c0534bcf0439 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/FakeClassnameTags123Api.md @@ -0,0 +1,81 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case | + + + +## testClassname + +> Client testClassname(client) + +To test class name in snake case + +To test class name in snake case + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.FakeClassnameTags123Api; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); + + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey3/docs/FileSchemaTestClass.md b/samples/client/petstore/java/jersey3/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..85d1a0636694 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/FileSchemaTestClass.md @@ -0,0 +1,14 @@ + + +# FileSchemaTestClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_file** | [**ModelFile**](ModelFile.md) | | [optional] | +|**files** | [**List<ModelFile>**](ModelFile.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Foo.md b/samples/client/petstore/java/jersey3/docs/Foo.md new file mode 100644 index 000000000000..6b3f0556528a --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Foo.md @@ -0,0 +1,13 @@ + + +# Foo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/FormatTest.md b/samples/client/petstore/java/jersey3/docs/FormatTest.md new file mode 100644 index 000000000000..01b8c777ae06 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/FormatTest.md @@ -0,0 +1,28 @@ + + +# FormatTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integer** | **Integer** | | [optional] | +|**int32** | **Integer** | | [optional] | +|**int64** | **Long** | | [optional] | +|**number** | **BigDecimal** | | | +|**_float** | **Float** | | [optional] | +|**_double** | **Double** | | [optional] | +|**decimal** | **BigDecimal** | | [optional] | +|**string** | **String** | | [optional] | +|**_byte** | **byte[]** | | | +|**binary** | **File** | | [optional] | +|**date** | **LocalDate** | | | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**uuid** | **UUID** | | [optional] | +|**password** | **String** | | | +|**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] | +|**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Fruit.md b/samples/client/petstore/java/jersey3/docs/Fruit.md new file mode 100644 index 000000000000..41b3152250e1 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Fruit.md @@ -0,0 +1,37 @@ + + +# Fruit + +## oneOf schemas +* [Apple](Apple.md) +* [Banana](Banana.md) + +## Example +```java +// Import classes: +import org.openapitools.client.model.Fruit; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; + +public class Example { + public static void main(String[] args) { + Fruit exampleFruit = new Fruit(); + + // create a new Apple + Apple exampleApple = new Apple(); + // set Fruit to Apple + exampleFruit.setActualInstance(exampleApple); + // to get back the Apple set earlier + Apple testApple = (Apple) exampleFruit.getActualInstance(); + + // create a new Banana + Banana exampleBanana = new Banana(); + // set Fruit to Banana + exampleFruit.setActualInstance(exampleBanana); + // to get back the Banana set earlier + Banana testBanana = (Banana) exampleFruit.getActualInstance(); + } +} +``` + + diff --git a/samples/client/petstore/java/jersey3/docs/FruitReq.md b/samples/client/petstore/java/jersey3/docs/FruitReq.md new file mode 100644 index 000000000000..9d9c875cd39a --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/FruitReq.md @@ -0,0 +1,39 @@ + + +# FruitReq + +## oneOf schemas +* [AppleReq](AppleReq.md) +* [BananaReq](BananaReq.md) + +NOTE: this class is nullable. + +## Example +```java +// Import classes: +import org.openapitools.client.model.FruitReq; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; + +public class Example { + public static void main(String[] args) { + FruitReq exampleFruitReq = new FruitReq(); + + // create a new AppleReq + AppleReq exampleAppleReq = new AppleReq(); + // set FruitReq to AppleReq + exampleFruitReq.setActualInstance(exampleAppleReq); + // to get back the AppleReq set earlier + AppleReq testAppleReq = (AppleReq) exampleFruitReq.getActualInstance(); + + // create a new BananaReq + BananaReq exampleBananaReq = new BananaReq(); + // set FruitReq to BananaReq + exampleFruitReq.setActualInstance(exampleBananaReq); + // to get back the BananaReq set earlier + BananaReq testBananaReq = (BananaReq) exampleFruitReq.getActualInstance(); + } +} +``` + + diff --git a/samples/client/petstore/java/jersey3/docs/GmFruit.md b/samples/client/petstore/java/jersey3/docs/GmFruit.md new file mode 100644 index 000000000000..c9dc50b92cb7 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/GmFruit.md @@ -0,0 +1,37 @@ + + +# GmFruit + +## anyOf schemas +* [Apple](Apple.md) +* [Banana](Banana.md) + +## Example +```java +// Import classes: +import org.openapitools.client.model.GmFruit; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; + +public class Example { + public static void main(String[] args) { + GmFruit exampleGmFruit = new GmFruit(); + + // create a new Apple + Apple exampleApple = new Apple(); + // set GmFruit to Apple + exampleGmFruit.setActualInstance(exampleApple); + // to get back the Apple set earlier + Apple testApple = (Apple) exampleGmFruit.getActualInstance(); + + // create a new Banana + Banana exampleBanana = new Banana(); + // set GmFruit to Banana + exampleGmFruit.setActualInstance(exampleBanana); + // to get back the Banana set earlier + Banana testBanana = (Banana) exampleGmFruit.getActualInstance(); + } +} +``` + + diff --git a/samples/client/petstore/java/jersey3/docs/GrandparentAnimal.md b/samples/client/petstore/java/jersey3/docs/GrandparentAnimal.md new file mode 100644 index 000000000000..9737408f2724 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/GrandparentAnimal.md @@ -0,0 +1,13 @@ + + +# GrandparentAnimal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**petType** | **String** | | | + + + diff --git a/samples/client/petstore/java/jersey3/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/jersey3/docs/HasOnlyReadOnly.md new file mode 100644 index 000000000000..29da5205dbba --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/HasOnlyReadOnly.md @@ -0,0 +1,14 @@ + + +# HasOnlyReadOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**foo** | **String** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/HealthCheckResult.md b/samples/client/petstore/java/jersey3/docs/HealthCheckResult.md new file mode 100644 index 000000000000..4885e6f1cada --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/HealthCheckResult.md @@ -0,0 +1,14 @@ + + +# HealthCheckResult + +Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**nullableMessage** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/InlineObject.md b/samples/client/petstore/java/jersey3/docs/InlineObject.md new file mode 100644 index 000000000000..999fe3ef00ad --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/InlineObject.md @@ -0,0 +1,13 @@ + + +# InlineObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Updated name of the pet | [optional] +**status** | **String** | Updated status of the pet | [optional] + + + diff --git a/samples/client/petstore/java/jersey3/docs/InlineObject1.md b/samples/client/petstore/java/jersey3/docs/InlineObject1.md new file mode 100644 index 000000000000..10cc19ce03ce --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/InlineObject1.md @@ -0,0 +1,13 @@ + + +# InlineObject1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additionalMetadata** | **String** | Additional data to pass to server | [optional] +**file** | **File** | file to upload | [optional] + + + diff --git a/samples/client/petstore/java/jersey3/docs/InlineObject2.md b/samples/client/petstore/java/jersey3/docs/InlineObject2.md new file mode 100644 index 000000000000..7e4ed7591c2a --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/InlineObject2.md @@ -0,0 +1,32 @@ + + +# InlineObject2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumFormStringArray** | [**List<EnumFormStringArrayEnum>**](#List<EnumFormStringArrayEnum>) | Form parameter enum test (string array) | [optional] +**enumFormString** | [**EnumFormStringEnum**](#EnumFormStringEnum) | Form parameter enum test (string) | [optional] + + + +## Enum: List<EnumFormStringArrayEnum> + +Name | Value +---- | ----- +GREATER_THAN | ">" +DOLLAR | "$" + + + +## Enum: EnumFormStringEnum + +Name | Value +---- | ----- +_ABC | "_abc" +_EFG | "-efg" +_XYZ_ | "(xyz)" + + + diff --git a/samples/client/petstore/java/jersey3/docs/InlineObject3.md b/samples/client/petstore/java/jersey3/docs/InlineObject3.md new file mode 100644 index 000000000000..fef7fdf80327 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/InlineObject3.md @@ -0,0 +1,25 @@ + + +# InlineObject3 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Integer** | None | [optional] +**int32** | **Integer** | None | [optional] +**int64** | **Long** | None | [optional] +**number** | **BigDecimal** | None | +**_float** | **Float** | None | [optional] +**_double** | **Double** | None | +**string** | **String** | None | [optional] +**patternWithoutDelimiter** | **String** | None | +**_byte** | **byte[]** | None | +**binary** | **File** | None | [optional] +**date** | **LocalDate** | None | [optional] +**dateTime** | **OffsetDateTime** | None | [optional] +**password** | **String** | None | [optional] +**callback** | **String** | None | [optional] + + + diff --git a/samples/client/petstore/java/jersey3/docs/InlineObject4.md b/samples/client/petstore/java/jersey3/docs/InlineObject4.md new file mode 100644 index 000000000000..5ebef872403a --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/InlineObject4.md @@ -0,0 +1,13 @@ + + +# InlineObject4 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**param** | **String** | field1 | +**param2** | **String** | field2 | + + + diff --git a/samples/client/petstore/java/jersey3/docs/InlineObject5.md b/samples/client/petstore/java/jersey3/docs/InlineObject5.md new file mode 100644 index 000000000000..ec5d4309f4d0 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/InlineObject5.md @@ -0,0 +1,13 @@ + + +# InlineObject5 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additionalMetadata** | **String** | Additional data to pass to server | [optional] +**requiredFile** | **File** | file to upload | + + + diff --git a/samples/client/petstore/java/jersey3/docs/InlineResponseDefault.md b/samples/client/petstore/java/jersey3/docs/InlineResponseDefault.md new file mode 100644 index 000000000000..41cadb0373c2 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/InlineResponseDefault.md @@ -0,0 +1,13 @@ + + +# InlineResponseDefault + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**string** | [**Foo**](Foo.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/IsoscelesTriangle.md b/samples/client/petstore/java/jersey3/docs/IsoscelesTriangle.md new file mode 100644 index 000000000000..0bd5045bc68f --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/IsoscelesTriangle.md @@ -0,0 +1,14 @@ + + +# IsoscelesTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Mammal.md b/samples/client/petstore/java/jersey3/docs/Mammal.md new file mode 100644 index 000000000000..11bbff5e2ba9 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Mammal.md @@ -0,0 +1,46 @@ + + +# Mammal + +## oneOf schemas +* [Pig](Pig.md) +* [Whale](Whale.md) +* [Zebra](Zebra.md) + +## Example +```java +// Import classes: +import org.openapitools.client.model.Mammal; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; + +public class Example { + public static void main(String[] args) { + Mammal exampleMammal = new Mammal(); + + // create a new Pig + Pig examplePig = new Pig(); + // set Mammal to Pig + exampleMammal.setActualInstance(examplePig); + // to get back the Pig set earlier + Pig testPig = (Pig) exampleMammal.getActualInstance(); + + // create a new Whale + Whale exampleWhale = new Whale(); + // set Mammal to Whale + exampleMammal.setActualInstance(exampleWhale); + // to get back the Whale set earlier + Whale testWhale = (Whale) exampleMammal.getActualInstance(); + + // create a new Zebra + Zebra exampleZebra = new Zebra(); + // set Mammal to Zebra + exampleMammal.setActualInstance(exampleZebra); + // to get back the Zebra set earlier + Zebra testZebra = (Zebra) exampleMammal.getActualInstance(); + } +} +``` + + diff --git a/samples/client/petstore/java/jersey3/docs/MapTest.md b/samples/client/petstore/java/jersey3/docs/MapTest.md new file mode 100644 index 000000000000..54380188e1d6 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/MapTest.md @@ -0,0 +1,25 @@ + + +# MapTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapMapOfString** | **Map<String, Map<String, String>>** | | [optional] | +|**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] | +|**directMap** | **Map<String, Boolean>** | | [optional] | +|**indirectMap** | **Map<String, Boolean>** | | [optional] | + + + +## Enum: Map<String, InnerEnum> + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | + + + diff --git a/samples/client/petstore/java/jersey3/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/jersey3/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..a5ddf0faa6a9 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,15 @@ + + +# MixedPropertiesAndAdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **UUID** | | [optional] | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**map** | [**Map<String, Animal>**](Animal.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Model200Response.md b/samples/client/petstore/java/jersey3/docs/Model200Response.md new file mode 100644 index 000000000000..109411580c62 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Model200Response.md @@ -0,0 +1,15 @@ + + +# Model200Response + +Model for testing model name starting with number + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | [optional] | +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ModelApiResponse.md b/samples/client/petstore/java/jersey3/docs/ModelApiResponse.md new file mode 100644 index 000000000000..e374c2dd2dec --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ModelApiResponse.md @@ -0,0 +1,15 @@ + + +# ModelApiResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ModelFile.md b/samples/client/petstore/java/jersey3/docs/ModelFile.md new file mode 100644 index 000000000000..adcde984f527 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ModelFile.md @@ -0,0 +1,14 @@ + + +# ModelFile + +Must be named `File` for test. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**sourceURI** | **String** | Test capitalization | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ModelList.md b/samples/client/petstore/java/jersey3/docs/ModelList.md new file mode 100644 index 000000000000..f93ab7dde8d4 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ModelList.md @@ -0,0 +1,13 @@ + + +# ModelList + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_123list** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ModelReturn.md b/samples/client/petstore/java/jersey3/docs/ModelReturn.md new file mode 100644 index 000000000000..0bd356861eb7 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ModelReturn.md @@ -0,0 +1,14 @@ + + +# ModelReturn + +Model for testing reserved words + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_return** | **Integer** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Name.md b/samples/client/petstore/java/jersey3/docs/Name.md new file mode 100644 index 000000000000..c901d9435309 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Name.md @@ -0,0 +1,17 @@ + + +# Name + +Model for testing model name same as property name + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | | +|**snakeCase** | **Integer** | | [optional] [readonly] | +|**property** | **String** | | [optional] | +|**_123number** | **Integer** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/NullableClass.md b/samples/client/petstore/java/jersey3/docs/NullableClass.md new file mode 100644 index 000000000000..fa98c5c6d984 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/NullableClass.md @@ -0,0 +1,24 @@ + + +# NullableClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integerProp** | **Integer** | | [optional] | +|**numberProp** | **BigDecimal** | | [optional] | +|**booleanProp** | **Boolean** | | [optional] | +|**stringProp** | **String** | | [optional] | +|**dateProp** | **LocalDate** | | [optional] | +|**datetimeProp** | **OffsetDateTime** | | [optional] | +|**arrayNullableProp** | **List<Object>** | | [optional] | +|**arrayAndItemsNullableProp** | **List<Object>** | | [optional] | +|**arrayItemsNullable** | **List<Object>** | | [optional] | +|**objectNullableProp** | **Map<String, Object>** | | [optional] | +|**objectAndItemsNullableProp** | **Map<String, Object>** | | [optional] | +|**objectItemsNullable** | **Map<String, Object>** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/NullableShape.md b/samples/client/petstore/java/jersey3/docs/NullableShape.md new file mode 100644 index 000000000000..60c45b268406 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/NullableShape.md @@ -0,0 +1,41 @@ + + +# NullableShape + +The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1. + +## oneOf schemas +* [Quadrilateral](Quadrilateral.md) +* [Triangle](Triangle.md) + +NOTE: this class is nullable. + +## Example +```java +// Import classes: +import org.openapitools.client.model.NullableShape; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +public class Example { + public static void main(String[] args) { + NullableShape exampleNullableShape = new NullableShape(); + + // create a new Quadrilateral + Quadrilateral exampleQuadrilateral = new Quadrilateral(); + // set NullableShape to Quadrilateral + exampleNullableShape.setActualInstance(exampleQuadrilateral); + // to get back the Quadrilateral set earlier + Quadrilateral testQuadrilateral = (Quadrilateral) exampleNullableShape.getActualInstance(); + + // create a new Triangle + Triangle exampleTriangle = new Triangle(); + // set NullableShape to Triangle + exampleNullableShape.setActualInstance(exampleTriangle); + // to get back the Triangle set earlier + Triangle testTriangle = (Triangle) exampleNullableShape.getActualInstance(); + } +} +``` + + diff --git a/samples/client/petstore/java/jersey3/docs/NumberOnly.md b/samples/client/petstore/java/jersey3/docs/NumberOnly.md new file mode 100644 index 000000000000..b8ed1a4cfae1 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/NumberOnly.md @@ -0,0 +1,13 @@ + + +# NumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justNumber** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ObjectWithDeprecatedFields.md b/samples/client/petstore/java/jersey3/docs/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..f1cf571f4c09 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ObjectWithDeprecatedFields.md @@ -0,0 +1,16 @@ + + +# ObjectWithDeprecatedFields + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **String** | | [optional] | +|**id** | **BigDecimal** | | [optional] | +|**deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] | +|**bars** | **List<String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Order.md b/samples/client/petstore/java/jersey3/docs/Order.md new file mode 100644 index 000000000000..27af32855c5c --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Order.md @@ -0,0 +1,28 @@ + + +# Order + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/jersey3/docs/OuterComposite.md b/samples/client/petstore/java/jersey3/docs/OuterComposite.md new file mode 100644 index 000000000000..98b56e0763ff --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/OuterComposite.md @@ -0,0 +1,15 @@ + + +# OuterComposite + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**myNumber** | **BigDecimal** | | [optional] | +|**myString** | **String** | | [optional] | +|**myBoolean** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/OuterEnum.md b/samples/client/petstore/java/jersey3/docs/OuterEnum.md new file mode 100644 index 000000000000..1f9b723eb8e7 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/OuterEnum.md @@ -0,0 +1,15 @@ + + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/jersey3/docs/OuterEnumDefaultValue.md b/samples/client/petstore/java/jersey3/docs/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..cbc7f4ba54d2 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/OuterEnumDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumDefaultValue + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/jersey3/docs/OuterEnumInteger.md b/samples/client/petstore/java/jersey3/docs/OuterEnumInteger.md new file mode 100644 index 000000000000..f71dea30ad00 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/OuterEnumInteger.md @@ -0,0 +1,15 @@ + + +# OuterEnumInteger + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/jersey3/docs/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/java/jersey3/docs/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..99e6389f4278 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumIntegerDefaultValue + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/jersey3/docs/ParentPet.md b/samples/client/petstore/java/jersey3/docs/ParentPet.md new file mode 100644 index 000000000000..4992b88a6710 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ParentPet.md @@ -0,0 +1,12 @@ + + +# ParentPet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/jersey3/docs/Pet.md b/samples/client/petstore/java/jersey3/docs/Pet.md new file mode 100644 index 000000000000..08dfd8623602 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Pet.md @@ -0,0 +1,28 @@ + + +# Pet + + +## 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/client/petstore/java/jersey3/docs/PetApi.md b/samples/client/petstore/java/jersey3/docs/PetApi.md new file mode 100644 index 000000000000..eb2957e47054 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/PetApi.md @@ -0,0 +1,671 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io:80/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 | +| [**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) | + + + +## addPet + +> addPet(pet) + +Add a new pet to the store + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(pet); + } 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 + +null (empty response body) + +### Authorization + +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +## deletePet + +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### 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.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + 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>**| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[http_signature_test](../README.md#http_signature_test), [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.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + 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>**| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[http_signature_test](../README.md#http_signature_test), [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 tag value | - | + + +## getPetById + +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + 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 + +> updatePet(pet) + +Update an existing pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(pet); + } 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 + +null (empty response body) + +### Authorization + +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +## updatePetWithForm + +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### 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 java.io.File; +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + 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 | - | + + +## uploadFileWithRequiredFile + +> ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + + + +### Example + +```java +import java.io.File; +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **requiredFile** | **File**| file to upload | | +| **additionalMetadata** | **String**| Additional data to pass to server | [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/client/petstore/java/jersey3/docs/Pig.md b/samples/client/petstore/java/jersey3/docs/Pig.md new file mode 100644 index 000000000000..f0a92bbe61b8 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Pig.md @@ -0,0 +1,37 @@ + + +# Pig + +## oneOf schemas +* [BasquePig](BasquePig.md) +* [DanishPig](DanishPig.md) + +## Example +```java +// Import classes: +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.DanishPig; + +public class Example { + public static void main(String[] args) { + Pig examplePig = new Pig(); + + // create a new BasquePig + BasquePig exampleBasquePig = new BasquePig(); + // set Pig to BasquePig + examplePig.setActualInstance(exampleBasquePig); + // to get back the BasquePig set earlier + BasquePig testBasquePig = (BasquePig) examplePig.getActualInstance(); + + // create a new DanishPig + DanishPig exampleDanishPig = new DanishPig(); + // set Pig to DanishPig + examplePig.setActualInstance(exampleDanishPig); + // to get back the DanishPig set earlier + DanishPig testDanishPig = (DanishPig) examplePig.getActualInstance(); + } +} +``` + + diff --git a/samples/client/petstore/java/jersey3/docs/Quadrilateral.md b/samples/client/petstore/java/jersey3/docs/Quadrilateral.md new file mode 100644 index 000000000000..83ffea0c742f --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Quadrilateral.md @@ -0,0 +1,37 @@ + + +# Quadrilateral + +## oneOf schemas +* [ComplexQuadrilateral](ComplexQuadrilateral.md) +* [SimpleQuadrilateral](SimpleQuadrilateral.md) + +## Example +```java +// Import classes: +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; + +public class Example { + public static void main(String[] args) { + Quadrilateral exampleQuadrilateral = new Quadrilateral(); + + // create a new ComplexQuadrilateral + ComplexQuadrilateral exampleComplexQuadrilateral = new ComplexQuadrilateral(); + // set Quadrilateral to ComplexQuadrilateral + exampleQuadrilateral.setActualInstance(exampleComplexQuadrilateral); + // to get back the ComplexQuadrilateral set earlier + ComplexQuadrilateral testComplexQuadrilateral = (ComplexQuadrilateral) exampleQuadrilateral.getActualInstance(); + + // create a new SimpleQuadrilateral + SimpleQuadrilateral exampleSimpleQuadrilateral = new SimpleQuadrilateral(); + // set Quadrilateral to SimpleQuadrilateral + exampleQuadrilateral.setActualInstance(exampleSimpleQuadrilateral); + // to get back the SimpleQuadrilateral set earlier + SimpleQuadrilateral testSimpleQuadrilateral = (SimpleQuadrilateral) exampleQuadrilateral.getActualInstance(); + } +} +``` + + diff --git a/samples/client/petstore/java/jersey3/docs/QuadrilateralInterface.md b/samples/client/petstore/java/jersey3/docs/QuadrilateralInterface.md new file mode 100644 index 000000000000..99451f3bd020 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/QuadrilateralInterface.md @@ -0,0 +1,13 @@ + + +# QuadrilateralInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ReadOnlyFirst.md b/samples/client/petstore/java/jersey3/docs/ReadOnlyFirst.md new file mode 100644 index 000000000000..ad6af7ee155f --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ReadOnlyFirst.md @@ -0,0 +1,14 @@ + + +# ReadOnlyFirst + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**baz** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ScaleneTriangle.md b/samples/client/petstore/java/jersey3/docs/ScaleneTriangle.md new file mode 100644 index 000000000000..c578f6cbfaab --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ScaleneTriangle.md @@ -0,0 +1,14 @@ + + +# ScaleneTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Shape.md b/samples/client/petstore/java/jersey3/docs/Shape.md new file mode 100644 index 000000000000..9c237eefb048 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Shape.md @@ -0,0 +1,37 @@ + + +# Shape + +## oneOf schemas +* [Quadrilateral](Quadrilateral.md) +* [Triangle](Triangle.md) + +## Example +```java +// Import classes: +import org.openapitools.client.model.Shape; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +public class Example { + public static void main(String[] args) { + Shape exampleShape = new Shape(); + + // create a new Quadrilateral + Quadrilateral exampleQuadrilateral = new Quadrilateral(); + // set Shape to Quadrilateral + exampleShape.setActualInstance(exampleQuadrilateral); + // to get back the Quadrilateral set earlier + Quadrilateral testQuadrilateral = (Quadrilateral) exampleShape.getActualInstance(); + + // create a new Triangle + Triangle exampleTriangle = new Triangle(); + // set Shape to Triangle + exampleShape.setActualInstance(exampleTriangle); + // to get back the Triangle set earlier + Triangle testTriangle = (Triangle) exampleShape.getActualInstance(); + } +} +``` + + diff --git a/samples/client/petstore/java/jersey3/docs/ShapeInterface.md b/samples/client/petstore/java/jersey3/docs/ShapeInterface.md new file mode 100644 index 000000000000..b4f981e3b566 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ShapeInterface.md @@ -0,0 +1,13 @@ + + +# ShapeInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | + + + diff --git a/samples/client/petstore/java/jersey3/docs/ShapeOrNull.md b/samples/client/petstore/java/jersey3/docs/ShapeOrNull.md new file mode 100644 index 000000000000..6a738c4b9870 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/ShapeOrNull.md @@ -0,0 +1,41 @@ + + +# ShapeOrNull + +The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + +## oneOf schemas +* [Quadrilateral](Quadrilateral.md) +* [Triangle](Triangle.md) + +NOTE: this class is nullable. + +## Example +```java +// Import classes: +import org.openapitools.client.model.ShapeOrNull; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +public class Example { + public static void main(String[] args) { + ShapeOrNull exampleShapeOrNull = new ShapeOrNull(); + + // create a new Quadrilateral + Quadrilateral exampleQuadrilateral = new Quadrilateral(); + // set ShapeOrNull to Quadrilateral + exampleShapeOrNull.setActualInstance(exampleQuadrilateral); + // to get back the Quadrilateral set earlier + Quadrilateral testQuadrilateral = (Quadrilateral) exampleShapeOrNull.getActualInstance(); + + // create a new Triangle + Triangle exampleTriangle = new Triangle(); + // set ShapeOrNull to Triangle + exampleShapeOrNull.setActualInstance(exampleTriangle); + // to get back the Triangle set earlier + Triangle testTriangle = (Triangle) exampleShapeOrNull.getActualInstance(); + } +} +``` + + diff --git a/samples/client/petstore/java/jersey3/docs/SimpleQuadrilateral.md b/samples/client/petstore/java/jersey3/docs/SimpleQuadrilateral.md new file mode 100644 index 000000000000..52fb7d1a6a49 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/SimpleQuadrilateral.md @@ -0,0 +1,14 @@ + + +# SimpleQuadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/jersey3/docs/SpecialModelName.md b/samples/client/petstore/java/jersey3/docs/SpecialModelName.md new file mode 100644 index 000000000000..e17d0d797b7f --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/SpecialModelName.md @@ -0,0 +1,14 @@ + + +# SpecialModelName + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**$specialPropertyName** | **Long** | | [optional] | +|**specialModelName** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/StoreApi.md b/samples/client/petstore/java/jersey3/docs/StoreApi.md new file mode 100644 index 000000000000..a3cbc7ec0507 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/StoreApi.md @@ -0,0 +1,278 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | + + + +## deleteOrder + +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### 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.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + 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 generated exceptions + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + 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.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + 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/client/petstore/java/jersey3/docs/Tag.md b/samples/client/petstore/java/jersey3/docs/Tag.md new file mode 100644 index 000000000000..5088b2dd1c31 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Tag.md @@ -0,0 +1,14 @@ + + +# Tag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Triangle.md b/samples/client/petstore/java/jersey3/docs/Triangle.md new file mode 100644 index 000000000000..daf9d153ff61 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Triangle.md @@ -0,0 +1,46 @@ + + +# Triangle + +## oneOf schemas +* [EquilateralTriangle](EquilateralTriangle.md) +* [IsoscelesTriangle](IsoscelesTriangle.md) +* [ScaleneTriangle](ScaleneTriangle.md) + +## Example +```java +// Import classes: +import org.openapitools.client.model.Triangle; +import org.openapitools.client.model.EquilateralTriangle; +import org.openapitools.client.model.IsoscelesTriangle; +import org.openapitools.client.model.ScaleneTriangle; + +public class Example { + public static void main(String[] args) { + Triangle exampleTriangle = new Triangle(); + + // create a new EquilateralTriangle + EquilateralTriangle exampleEquilateralTriangle = new EquilateralTriangle(); + // set Triangle to EquilateralTriangle + exampleTriangle.setActualInstance(exampleEquilateralTriangle); + // to get back the EquilateralTriangle set earlier + EquilateralTriangle testEquilateralTriangle = (EquilateralTriangle) exampleTriangle.getActualInstance(); + + // create a new IsoscelesTriangle + IsoscelesTriangle exampleIsoscelesTriangle = new IsoscelesTriangle(); + // set Triangle to IsoscelesTriangle + exampleTriangle.setActualInstance(exampleIsoscelesTriangle); + // to get back the IsoscelesTriangle set earlier + IsoscelesTriangle testIsoscelesTriangle = (IsoscelesTriangle) exampleTriangle.getActualInstance(); + + // create a new ScaleneTriangle + ScaleneTriangle exampleScaleneTriangle = new ScaleneTriangle(); + // set Triangle to ScaleneTriangle + exampleTriangle.setActualInstance(exampleScaleneTriangle); + // to get back the ScaleneTriangle set earlier + ScaleneTriangle testScaleneTriangle = (ScaleneTriangle) exampleTriangle.getActualInstance(); + } +} +``` + + diff --git a/samples/client/petstore/java/jersey3/docs/TriangleInterface.md b/samples/client/petstore/java/jersey3/docs/TriangleInterface.md new file mode 100644 index 000000000000..ef5fc7575f34 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/TriangleInterface.md @@ -0,0 +1,13 @@ + + +# TriangleInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/jersey3/docs/User.md b/samples/client/petstore/java/jersey3/docs/User.md new file mode 100644 index 000000000000..9e97dc35485f --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/User.md @@ -0,0 +1,24 @@ + + +# User + + +## 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] | +|**objectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] | +|**objectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] | +|**anyTypeProp** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 | [optional] | +|**anyTypePropNullable** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/UserApi.md b/samples/client/petstore/java/jersey3/docs/UserApi.md new file mode 100644 index 000000000000..6df604acce37 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/UserApi.md @@ -0,0 +1,535 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io:80/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 + +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } 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 + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithArrayInput + +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } 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 + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithListInput + +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } 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 + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## deleteUser + +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### 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.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + 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.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + 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 | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + + +## logoutUser + +> logoutUser() + +Logs out current logged in user session + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## updateUser + +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + 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 { + apiInstance.updateUser(username, user); + } 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 + +null (empty response body) + +### Authorization + +No authorization required + +### 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/client/petstore/java/jersey3/docs/Whale.md b/samples/client/petstore/java/jersey3/docs/Whale.md new file mode 100644 index 000000000000..30ce4bb82151 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Whale.md @@ -0,0 +1,15 @@ + + +# Whale + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasBaleen** | **Boolean** | | [optional] | +|**hasTeeth** | **Boolean** | | [optional] | +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/jersey3/docs/Zebra.md b/samples/client/petstore/java/jersey3/docs/Zebra.md new file mode 100644 index 000000000000..f7c4389b6456 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/Zebra.md @@ -0,0 +1,24 @@ + + +# Zebra + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | +|**className** | **String** | | | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| PLAINS | "plains" | +| MOUNTAIN | "mountain" | +| GREVYS | "grevys" | + + + diff --git a/samples/client/petstore/java/jersey3/git_push.sh b/samples/client/petstore/java/jersey3/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/jersey3/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/petstore/java/jersey3/gradle.properties b/samples/client/petstore/java/jersey3/gradle.properties new file mode 100644 index 000000000000..d3e8e41ba6fb --- /dev/null +++ b/samples/client/petstore/java/jersey3/gradle.properties @@ -0,0 +1,13 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android + +# JVM arguments +org.gradle.jvmargs=-Xmx2024m -XX:MaxPermSize=512m +# set timeout +org.gradle.daemon.idletimeout=3600000 +# show all warnings +org.gradle.warning.mode=all diff --git a/samples/client/petstore/java/jersey3/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/jersey3/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..7454180f2ae8 Binary files /dev/null and b/samples/client/petstore/java/jersey3/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/jersey3/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/jersey3/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..ffed3a254e91 --- /dev/null +++ b/samples/client/petstore/java/jersey3/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/jersey3/gradlew b/samples/client/petstore/java/jersey3/gradlew new file mode 100644 index 000000000000..005bcde04284 --- /dev/null +++ b/samples/client/petstore/java/jersey3/gradlew @@ -0,0 +1,234 @@ +#!/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/master/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 + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' + +# 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 + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + 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 + +# 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. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# 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/java/jersey3/gradlew.bat b/samples/client/petstore/java/jersey3/gradlew.bat new file mode 100644 index 000000000000..6a68175eb70f --- /dev/null +++ b/samples/client/petstore/java/jersey3/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem 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=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto 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%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/jersey3/pom.xml b/samples/client/petstore/java/jersey3/pom.xml new file mode 100644 index 000000000000..fbe5148197e8 --- /dev/null +++ b/samples/client/petstore/java/jersey3/pom.xml @@ -0,0 +1,357 @@ + + 4.0.0 + org.openapitools + petstore-jersey3 + jar + petstore-jersey3 + 1.0.0 + https://github.com/openapitools/openapi-generator + OpenAPI Java + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + + + + + Unlicense + https://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M5 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + false + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.2 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.3.2 + + + attach-javadocs + + jar + + + + + none + 1.8 + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.0 + + + attach-sources + + jar-no-fork + + + + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless.version} + + + + + + + .gitignore + + + + + + true + 4 + + + + + + + + + + 1.8 + + true + + + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + io.swagger + swagger-annotations + ${swagger-annotations-version} + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + + + org.glassfish.jersey.core + jersey-client + ${jersey-version} + + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey-version} + + + org.glassfish.jersey.media + jersey-media-multipart + ${jersey-version} + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${jersey-version} + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + org.tomitribe + tomitribe-http-signatures + ${http-signature-version} + + + com.github.scribejava + scribejava-apis + ${scribejava-apis-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + org.glassfish.jersey.connectors + jersey-apache-connector + ${jersey-version} + + + + org.junit.jupiter + junit-jupiter-api + ${junit-version} + test + + + + UTF-8 + 1.6.5 + 3.0.4 + 2.13.2 + 2.13.2 + 0.2.2 + 2.1.0 + 5.8.2 + 1.7 + 8.3.1 + 2.21.0 + + diff --git a/samples/client/petstore/java/jersey3/settings.gradle b/samples/client/petstore/java/jersey3/settings.gradle new file mode 100644 index 000000000000..b50c71ae7985 --- /dev/null +++ b/samples/client/petstore/java/jersey3/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-jersey3" \ No newline at end of file diff --git a/samples/client/petstore/java/jersey3/src/main/AndroidManifest.xml b/samples/client/petstore/java/jersey3/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..10170cec2b62 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1447 @@ +package org.openapitools.client; + +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.Form; +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import com.github.scribejava.core.model.OAuth2AccessToken; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.HttpUrlConnectorProvider; +import org.glassfish.jersey.jackson.JacksonFeature; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.MultiPart; +import org.glassfish.jersey.media.multipart.MultiPartFeature; + +import java.io.IOException; +import java.io.InputStream; + +import java.net.URI; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import java.security.cert.X509Certificate; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import org.glassfish.jersey.logging.LoggingFeature; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.Map.Entry; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Date; +import java.time.OffsetDateTime; + +import java.net.URLEncoder; + +import java.io.File; +import java.io.UnsupportedEncodingException; + +import java.text.DateFormat; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.openapitools.client.auth.Authentication; +import org.openapitools.client.auth.HttpBasicAuth; +import org.openapitools.client.auth.HttpBearerAuth; +import org.openapitools.client.auth.HttpSignatureAuth; +import org.openapitools.client.auth.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; + +/** + *

ApiClient class.

+ */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApiClient extends JavaTimeFormatter { + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String basePath = "http://petstore.swagger.io:80/v2"; + protected String userAgent; + private static final Logger log = Logger.getLogger(ApiClient.class.getName()); + + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://{server}.swagger.io:{port}/v2", + "petstore server", + new HashMap() {{ + put("server", new ServerVariable( + "No description provided", + "petstore", + new HashSet( + Arrays.asList( + "petstore", + "qa-petstore", + "dev-petstore" + ) + ) + )); + put("port", new ServerVariable( + "No description provided", + "80", + new HashSet( + Arrays.asList( + "80", + "8080" + ) + ) + )); + }} + ), + new ServerConfiguration( + "https://localhost:8080/{version}", + "The local server", + new HashMap() {{ + put("version", new ServerVariable( + "No description provided", + "v2", + new HashSet( + Arrays.asList( + "v1", + "v2" + ) + ) + )); + }} + ), + new ServerConfiguration( + "https://127.0.0.1/no_variable", + "The local server without variables", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected Map> operationServers = new HashMap>() {{ + put("PetApi.addPet", new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap() + ), + + new ServerConfiguration( + "http://path-server-test.petstore.local/v2", + "No description provided", + new HashMap() + ) + ))); + put("PetApi.updatePet", new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap() + ), + + new ServerConfiguration( + "http://path-server-test.petstore.local/v2", + "No description provided", + new HashMap() + ) + ))); + }}; + protected Map operationServerIndex = new HashMap(); + protected Map> operationServerVariables = new HashMap>(); + protected boolean debugging = false; + protected ClientConfig clientConfig; + protected int connectionTimeout = 0; + private int readTimeout = 0; + + protected Client httpClient; + protected JSON json; + protected String tempFolderPath = null; + + protected Map authentications; + protected Map authenticationLookup; + + protected DateFormat dateFormat; + + /** + * Constructs a new ApiClient with default parameters. + */ + public ApiClient() { + this(null); + } + + /** + * Constructs a new ApiClient with the specified authentication parameters. + * + * @param authMap A hash map containing authentication parameters. + */ + public ApiClient(Map authMap) { + json = new JSON(); + httpClient = buildHttpClient(); + + this.dateFormat = new RFC3339DateFormat(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap(); + Authentication auth = null; + if (authMap != null) { + auth = authMap.get("api_key"); + } + if (auth instanceof ApiKeyAuth) { + authentications.put("api_key", auth); + } else { + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + } + if (authMap != null) { + auth = authMap.get("api_key_query"); + } + if (auth instanceof ApiKeyAuth) { + authentications.put("api_key_query", auth); + } else { + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + } + if (authMap != null) { + auth = authMap.get("bearer_test"); + } + if (auth instanceof HttpBearerAuth) { + authentications.put("bearer_test", auth); + } else { + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + } + if (authMap != null) { + auth = authMap.get("http_basic_test"); + } + if (auth instanceof HttpBasicAuth) { + authentications.put("http_basic_test", auth); + } else { + authentications.put("http_basic_test", new HttpBasicAuth()); + } + if (authMap != null) { + auth = authMap.get("http_signature_test"); + } + if (auth instanceof HttpSignatureAuth) { + authentications.put("http_signature_test", auth); + } + if (authMap != null) { + auth = authMap.get("petstore_auth"); + } + if (auth instanceof OAuth) { + authentications.put("petstore_auth", auth); + } else { + authentications.put("petstore_auth", new OAuth(basePath, "")); + } + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + + // Setup authentication lookup (key: authentication alias, value: authentication name) + authenticationLookup = new HashMap(); + } + + /** + * Gets the JSON instance to do JSON serialization and deserialization. + * + * @return JSON + */ + public JSON getJSON() { + return json; + } + + /** + *

Getter for the field httpClient.

+ * + * @return a {@link jakarta.ws.rs.client.Client} object. + */ + public Client getHttpClient() { + return httpClient; + } + + /** + *

Setter for the field httpClient.

+ * + * @param httpClient a {@link jakarta.ws.rs.client.Client} object. + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setHttpClient(Client httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Returns the base URL to the location where the OpenAPI document is being served. + * + * @return The base URL to the target host. + */ + public String getBasePath() { + return basePath; + } + + /** + * Sets the base URL to the location where the OpenAPI document is being served. + * + * @param basePath The base URL to the target host. + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + setOauthBasePath(basePath); + return this; + } + + /** + *

Getter for the field servers.

+ * + * @return a {@link java.util.List} of servers. + */ + public List getServers() { + return servers; + } + + /** + *

Setter for the field servers.

+ * + * @param servers a {@link java.util.List} of servers. + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setServers(List servers) { + this.servers = servers; + updateBasePath(); + return this; + } + + /** + *

Getter for the field serverIndex.

+ * + * @return a {@link java.lang.Integer} object. + */ + public Integer getServerIndex() { + return serverIndex; + } + + /** + *

Setter for the field serverIndex.

+ * + * @param serverIndex the server index + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + updateBasePath(); + return this; + } + + /** + *

Getter for the field serverVariables.

+ * + * @return a {@link java.util.Map} of server variables. + */ + public Map getServerVariables() { + return serverVariables; + } + + /** + *

Setter for the field serverVariables.

+ * + * @param serverVariables a {@link java.util.Map} of server variables. + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + updateBasePath(); + return this; + } + + private void updateBasePath() { + if (serverIndex != null) { + setBasePath(servers.get(serverIndex).URL(serverVariables)); + } + } + + private void setOauthBasePath(String basePath) { + for(Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setBasePath(basePath); + } + } + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication object + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return this; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return this; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return this; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to configure authentications which respects aliases of API keys. + * + * @param secrets Hash map from authentication name to its secret. + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient configureApiKeys(Map secrets) { + for (Map.Entry authEntry : authentications.entrySet()) { + Authentication auth = authEntry.getValue(); + if (auth instanceof ApiKeyAuth) { + String name = authEntry.getKey(); + // respect x-auth-id-alias property + name = authenticationLookup.containsKey(name) ? authenticationLookup.get(name) : name; + if (secrets.containsKey(name)) { + ((ApiKeyAuth) auth).setApiKey(secrets.get(name)); + } + } + } + return this; + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return this; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set bearer token for the first Bearer authentication. + * + * @param bearerToken Bearer token + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setBearerToken(String bearerToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(bearerToken); + return this; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the credentials for the first OAuth2 authentication. + * + * @param clientId the client ID + * @param clientSecret the client secret + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setOauthCredentials(String clientId, String clientSecret) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setCredentials(clientId, clientSecret, isDebugging()); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the password flow for the first OAuth2 authentication. + * + * @param username the user name + * @param password the user password + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setOauthPasswordFlow(String username, String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).usePasswordFlow(username, password); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the authorization code flow for the first OAuth2 authentication. + * + * @param code the authorization code + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setOauthAuthorizationCodeFlow(String code) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).useAuthorizationCodeFlow(code); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the scopes for the first OAuth2 authentication. + * + * @param scope the oauth scope + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setOauthScope(String scope) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setScope(scope); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent Http user agent + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setUserAgent(String userAgent) { + this.userAgent = userAgent; + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Get the User-Agent header's value. + * + * @return User-Agent string + */ + public String getUserAgent(){ + return userAgent; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Gets the client config. + * + * @return Client config + */ + public ClientConfig getClientConfig() { + return clientConfig; + } + + /** + * Set the client config. + * + * @param clientConfig Set the client config + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setClientConfig(ClientConfig clientConfig) { + this.clientConfig = clientConfig; + // Rebuild HTTP Client according to the new "clientConfig" value. + this.httpClient = buildHttpClient(); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is switched on + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setDebugging(boolean debugging) { + this.debugging = debugging; + // Rebuild HTTP Client according to the new "debugging" value. + this.httpClient = buildHttpClient(); + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @return Temp folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set temp folder path + * + * @param tempFolderPath Temp folder path + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Connect timeout (in milliseconds). + * + * @return Connection timeout + */ + public int getConnectTimeout() { + return connectionTimeout; + } + + /** + * Set the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param connectionTimeout Connection timeout in milliseconds + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + this.connectionTimeout = connectionTimeout; + httpClient.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout); + return this; + } + + /** + * read timeout (in milliseconds). + * + * @return Read timeout + */ + public int getReadTimeout() { + return readTimeout; + } + + /** + * Set the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param readTimeout Read timeout in milliseconds + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setReadTimeout(int readTimeout) { + this.readTimeout = readTimeout; + httpClient.property(ClientProperties.READ_TIMEOUT, readTimeout); + return this; + } + + /** + * Get the date format used to parse/format date parameters. + * + * @return Date format + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + * Set the date format used to parse/format date parameters. + * + * @param dateFormat Date format + * @return a {@link org.openapitools.client.ApiClient} object. + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + // also set the date format for model (de)serialization with Date properties + this.json.setDateFormat((DateFormat) dateFormat.clone()); + return this; + } + + /** + * Parse the given string into Date object. + * + * @param str String + * @return Date + */ + public Date parseDate(String str) { + try { + return dateFormat.parse(str); + } catch (java.text.ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Format the given Date object into string. + * + * @param date Date + * @return Date in string format + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given parameter object into string. + * + * @param param Object + * @return Object in string format + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate((Date) param); + } else if (param instanceof OffsetDateTime) { + return formatOffsetDateTime((OffsetDateTime) param); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for(Object o : (Collection)param) { + if(b.length() > 0) { + b.append(','); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /* + * Format to {@code Pair} objects. + * + * @param collectionFormat Collection format + * @param name Name + * @param value Value + * @return List of pairs + */ + public List parameterToPairs(String collectionFormat, String name, Object value){ + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null) return params; + + Collection valueCollection; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(new Pair(name, parameterToString(value))); + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + // get the collection format (default: csv) + String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); + + // create the params based on the collection format + if ("multi".equals(format)) { + for (Object item : valueCollection) { + params.add(new Pair(name, parameterToString(item))); + } + + return params; + } + + String delimiter = ","; + + if ("csv".equals(format)) { + delimiter = ","; + } else if ("ssv".equals(format)) { + delimiter = " "; + } else if ("tsv".equals(format)) { + delimiter = "\t"; + } else if ("pipes".equals(format)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : valueCollection) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + params.add(new Pair(name, sb.substring(1))); + + return params; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * + * @param mime MIME + * @return True if the MIME type is JSON + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Serialize the given Java object into string entity according the given + * Content-Type (only JSON is supported for now). + * + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @return Entity + * @throws ApiException API exception + */ + public Entity serialize(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { + Entity entity; + if (contentType.startsWith("multipart/form-data")) { + MultiPart multiPart = new MultiPart(); + for (Entry param: formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) + .fileName(file.getName()).size(file.length()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); + } else { + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); + } + } + entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + Form form = new Form(); + for (Entry param: formParams.entrySet()) { + form.param(param.getKey(), parameterToString(param.getValue())); + } + entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); + } else { + // We let jersey handle the serialization + if (isBodyNullable) { // payload is nullable + if (obj instanceof String) { + entity = Entity.entity(obj == null ? "null" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType); + } else { + entity = Entity.entity(obj == null ? "null" : obj, contentType); + } + } else { + if (obj instanceof String) { + entity = Entity.entity(obj == null ? "" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType); + } else { + entity = Entity.entity(obj == null ? "" : obj, contentType); + } + } + } + return entity; + } + + /** + * Serialize the given Java object into string according the given + * Content-Type (only JSON, HTTP form is supported for now). + * + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @param isBodyNullable True if the body is nullable + * @return String + * @throws ApiException API exception + */ + public String serializeToString(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { + try { + if (contentType.startsWith("multipart/form-data")) { + throw new ApiException("multipart/form-data not yet supported for serializeToString (http signature authentication)"); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + String formString = ""; + for (Entry param : formParams.entrySet()) { + formString = param.getKey() + "=" + URLEncoder.encode(parameterToString(param.getValue()), "UTF-8") + "&"; + } + + if (formString.length() == 0) { // empty string + return formString; + } else { + return formString.substring(0, formString.length() - 1); + } + } else { + if (isBodyNullable) { + return obj == null ? "null" : json.getMapper().writeValueAsString(obj); + } else { + return obj == null ? "" : json.getMapper().writeValueAsString(obj); + } + } + } catch (Exception ex) { + throw new ApiException("Failed to perform serializeToString: " + ex.toString()); + } + } + + /** + * Deserialize response body to Java object according to the Content-Type. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Deserialize object + * @throws ApiException API exception + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, GenericType returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + return (T) response.readEntity(byte[].class); + } else if (returnType.getRawType() == File.class) { + // Handle file downloading. + T file = (T) downloadFileFromResponse(response); + return file; + } + + String contentType = null; + List contentTypes = response.getHeaders().get("Content-Type"); + if (contentTypes != null && !contentTypes.isEmpty()) + contentType = String.valueOf(contentTypes.get(0)); + + // read the entity stream multiple times + response.bufferEntity(); + + return response.readEntity(returnType); + } + + /** + * Download file from the given response. + * + * @param response Response + * @return File + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + *

Prepare the file for download from the response.

+ * + * @param response a {@link jakarta.ws.rs.core.Response} object. + * @return a {@link java.io.File} object. + * @throws java.io.IOException if any. + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) + filename = matcher.group(1); + } + + String prefix; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf('.'); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param Type + * @param operation The qualified name of the operation + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE" + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param authNames The authentications to apply + * @param returnType The return type into which to deserialize the response + * @param isBodyNullable True if the body is nullable + * @return The response body in type of string + * @throws ApiException API exception + */ + public ApiResponse invokeAPI( + String operation, + String path, + String method, + List queryParams, + Object body, + Map headerParams, + Map cookieParams, + Map formParams, + String accept, + String contentType, + String[] authNames, + GenericType returnType, + boolean isBodyNullable) + throws ApiException { + + // Not using `.target(targetURL).path(path)` below, + // to support (constant) query string in `path`, e.g. "/posts?draft=1" + String targetURL; + if (serverIndex != null && operationServers.containsKey(operation)) { + Integer index = operationServerIndex.containsKey(operation) ? operationServerIndex.get(operation) : serverIndex; + Map variables = operationServerVariables.containsKey(operation) ? + operationServerVariables.get(operation) : serverVariables; + List serverConfigurations = operationServers.get(operation); + if (index < 0 || index >= serverConfigurations.size()) { + throw new ArrayIndexOutOfBoundsException( + String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", + index, serverConfigurations.size())); + } + targetURL = serverConfigurations.get(index).URL(variables) + path; + } else { + targetURL = this.basePath + path; + } + WebTarget target = httpClient.target(targetURL); + + if (queryParams != null) { + for (Pair queryParam : queryParams) { + if (queryParam.getValue() != null) { + target = target.queryParam(queryParam.getName(), escapeString(queryParam.getValue())); + } + } + } + + Invocation.Builder invocationBuilder; + if (accept != null) { + invocationBuilder = target.request().accept(accept); + } else { + invocationBuilder = target.request(); + } + + for (Entry entry : cookieParams.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); + } + } + + for (Entry entry : defaultCookieMap.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); + } + } + + Entity entity = serialize(body, formParams, contentType, isBodyNullable); + + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + serializeToString(body, formParams, contentType, isBodyNullable), + method, + target.getUri()); + + for (Entry entry : allHeaderParams.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.header(entry.getKey(), value); + } + } + + Response response = null; + + try { + response = sendRequest(method, invocationBuilder, entity); + + // If OAuth is used and a status 401 is received, renew the access token and retry the request + if (response.getStatusInfo() == Status.UNAUTHORIZED) { + for (String authName : authNames) { + Authentication authentication = authentications.get(authName); + if (authentication instanceof OAuth) { + OAuth2AccessToken accessToken = ((OAuth) authentication).renewAccessToken(); + if (accessToken != null) { + invocationBuilder.header("Authorization", null); + invocationBuilder.header("Authorization", "Bearer " + accessToken.getAccessToken()); + response = sendRequest(method, invocationBuilder, entity); + } + break; + } + } + } + + int statusCode = response.getStatusInfo().getStatusCode(); + Map> responseHeaders = buildResponseHeaders(response); + + if (response.getStatusInfo() == Status.NO_CONTENT) { + return new ApiResponse(statusCode, responseHeaders); + } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { + if (returnType == null) { + return new ApiResponse(statusCode, responseHeaders); + } else { + return new ApiResponse(statusCode, responseHeaders, deserialize(response, returnType)); + } + } else { + String message = "error"; + String respBody = null; + if (response.hasEntity()) { + try { + respBody = String.valueOf(response.readEntity(String.class)); + message = respBody; + } catch (RuntimeException e) { + // e.printStackTrace(); + } + } + throw new ApiException( + response.getStatus(), message, buildResponseHeaders(response), respBody); + } + } finally { + try { + response.close(); + } catch (Exception e) { + // it's not critical, since the response object is local in method invokeAPI; that's fine, + // just continue + } + } + } + + private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity entity) { + Response response; + if ("POST".equals(method)) { + response = invocationBuilder.post(entity); + } else if ("PUT".equals(method)) { + response = invocationBuilder.put(entity); + } else if ("DELETE".equals(method)) { + response = invocationBuilder.method("DELETE", entity); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.method("PATCH", entity); + } else { + response = invocationBuilder.method(method); + } + return response; + } + + /** + * @deprecated Add qualified name of the operation as a first parameter. + */ + @Deprecated + public ApiResponse invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType, boolean isBodyNullable) throws ApiException { + return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, isBodyNullable); + } + + /** + * Build the Client used to make HTTP requests. + * + * @return Client + */ + protected Client buildHttpClient() { + // recreate the client config to pickup changes + clientConfig = getDefaultClientConfig(); + + ClientBuilder clientBuilder = ClientBuilder.newBuilder(); + customizeClientBuilder(clientBuilder); + clientBuilder = clientBuilder.withConfig(clientConfig); + return clientBuilder.build(); + } + + /** + * Get the default client config. + * + * @return Client config + */ + public ClientConfig getDefaultClientConfig() { + ClientConfig clientConfig = new ClientConfig(); + clientConfig.register(MultiPartFeature.class); + clientConfig.register(json); + clientConfig.register(JacksonFeature.class); + clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); + // turn off compliance validation to be able to send payloads with DELETE calls + clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + if (debugging) { + clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); + clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); + // Set logger to ALL + java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME).setLevel(java.util.logging.Level.ALL); + } else { + // suppress warnings for payloads with DELETE calls: + java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); + } + + return clientConfig; + } + + /** + * Customize the client builder. + * + * This method can be overridden to customize the API client. For example, this can be used to: + * 1. Set the hostname verifier to be used by the client to verify the endpoint's hostname + * against its identification information. + * 2. Set the client-side key store. + * 3. Set the SSL context that will be used when creating secured transport connections to + * server endpoints from web targets created by the client instance that is using this SSL context. + * 4. Set the client-side trust store. + * + * To completely disable certificate validation (at your own risk), you can + * override this method and invoke disableCertificateValidation(clientBuilder). + * + * @param clientBuilder a {@link jakarta.ws.rs.client.ClientBuilder} object. + */ + protected void customizeClientBuilder(ClientBuilder clientBuilder) { + // No-op extension point + } + + /** + * Disable X.509 certificate validation in TLS connections. + * + * Please note that trusting all certificates is extremely risky. + * This may be useful in a development environment with self-signed certificates. + * + * @param clientBuilder a {@link jakarta.ws.rs.client.ClientBuilder} object. + * @throws java.security.KeyManagementException if any. + * @throws java.security.NoSuchAlgorithmException if any. + */ + protected void disableCertificateValidation(ClientBuilder clientBuilder) throws KeyManagementException, NoSuchAlgorithmException { + TrustManager[] trustAllCerts = new X509TrustManager[] { + new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) { + } + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) { + } + } + }; + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(null, trustAllCerts, new SecureRandom()); + clientBuilder.sslContext(sslContext); + } + + /** + *

Build the response headers.

+ * + * @param response a {@link jakarta.ws.rs.core.Response} object. + * @return a {@link java.util.Map} of response headers. + */ + protected Map> buildResponseHeaders(Response response) { + Map> responseHeaders = new HashMap>(); + for (Entry> entry: response.getHeaders().entrySet()) { + List values = entry.getValue(); + List headers = new ArrayList(); + for (Object o : values) { + headers.add(String.valueOf(o)); + } + responseHeaders.put(entry.getKey(), headers); + } + return responseHeaders; + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + * @param method HTTP method (e.g. POST) + * @param uri HTTP URI + */ + protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, + Map cookieParams, String payload, String method, URI uri) throws ApiException { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + continue; + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..cf61335328e5 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,94 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Map; +import java.util.List; + +/** + * API Exception + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApiException extends Exception { + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..5f3daf26600c --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,74 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +public class ApiResponse { + private final int statusCode; + private final Map> headers; + private final T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + /** + * Get the status code + * + * @return status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + * Get the headers + * + * @return map of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + * Get the data + * + * @return data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..b027f63461cd --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,39 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Configuration { + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..4eece66820e8 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,249 @@ +package org.openapitools.client; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; +import org.openapitools.jackson.nullable.JsonNullableModule; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.openapitools.client.model.*; + +import java.text.DateFormat; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.ext.ContextResolver; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class JSON implements ContextResolver { + private ObjectMapper mapper; + + public JSON() { + mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.setDateFormat(new RFC3339DateFormat()); + mapper.registerModule(new JavaTimeModule()); + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + @Override + public ObjectMapper getContext(Class type) { + return mapper; + } + + /** + * Get the object mapper + * + * @return object mapper + */ + public ObjectMapper getMapper() { return mapper; } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asText(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (GenericType childType : descendants.values()) { + if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap, ClassDiscriminatorMapping>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map> modelDescendants = new HashMap, Map>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map descendants) { + modelDescendants.put(modelClass, descendants); + } + + private static JSON json; + + static + { + json = new JSON(); + } + + /** + * Get the default JSON instance. + * + * @return the default JSON instance + */ + public static JSON getDefault() { + return json; + } + + /** + * Set the default JSON instance. + * + * @param json JSON instance to be used + */ + public static void setDefault(JSON json) { + JSON.json = json; + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/JavaTimeFormatter.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/JavaTimeFormatter.java new file mode 100644 index 000000000000..ae934029f934 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/JavaTimeFormatter.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; + +/** + * Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class. + * It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}. + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class JavaTimeFormatter { + + private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; + + /** + * Get the date format used to parse/format {@code OffsetDateTime} parameters. + * @return DateTimeFormatter + */ + public DateTimeFormatter getOffsetDateTimeFormatter() { + return offsetDateTimeFormatter; + } + + /** + * Set the date format used to parse/format {@code OffsetDateTime} parameters. + * @param offsetDateTimeFormatter {@code DateTimeFormatter} + */ + public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) { + this.offsetDateTimeFormatter = offsetDateTimeFormatter; + } + + /** + * Parse the given string into {@code OffsetDateTime} object. + * @param str String + * @return {@code OffsetDateTime} + */ + public OffsetDateTime parseOffsetDateTime(String str) { + try { + return OffsetDateTime.parse(str, offsetDateTimeFormatter); + } catch (DateTimeParseException e) { + throw new RuntimeException(e); + } + } + /** + * Format the given {@code OffsetDateTime} object into string. + * @param offsetDateTime {@code OffsetDateTime} + * @return {@code OffsetDateTime} in string format + */ + public String formatOffsetDateTime(OffsetDateTime offsetDateTime) { + return offsetDateTimeFormatter.format(offsetDateTime); + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..8af540ca6576 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + return true; + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/RFC3339DateFormat.java new file mode 100644 index 000000000000..f94cba613ba4 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import com.fasterxml.jackson.databind.util.StdDateFormat; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.text.DecimalFormat; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + 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(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..ca5c1187edf2 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,58 @@ +package org.openapitools.client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replaceAll("\\{" + name + "\\}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..c2f13e216662 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,23 @@ +package org.openapitools.client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..9b10ec80d38b --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Collection; +import java.util.Iterator; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

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

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); + } + return out.toString(); + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/AnotherFakeApi.java new file mode 100644 index 000000000000..0437af1a111a --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -0,0 +1,115 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import jakarta.ws.rs.core.GenericType; + +import org.openapitools.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AnotherFakeApi { + private ApiClient apiClient; + + public AnotherFakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public AnotherFakeApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @return Client + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public Client call123testSpecialTags(Client client) throws ApiException { + return call123testSpecialTagsWithHttpInfo(client).getData(); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @return ApiResponse<Client> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse call123testSpecialTagsWithHttpInfo(Client client) throws ApiException { + Object localVarPostBody = client; + + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags"); + } + + // create path and map variables + String localVarPath = "/another-fake/dummy"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("AnotherFakeApi.call123testSpecialTags", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..90712d51e580 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,108 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import jakarta.ws.rs.core.GenericType; + +import org.openapitools.client.model.InlineResponseDefault; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DefaultApi { + private ApiClient apiClient; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * + * + * @return InlineResponseDefault + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 response -
+ */ + public InlineResponseDefault fooGet() throws ApiException { + return fooGetWithHttpInfo().getData(); + } + + /** + * + * + * @return ApiResponse<InlineResponseDefault> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 response -
+ */ + public ApiResponse fooGetWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/foo"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("DefaultApi.fooGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 000000000000..9f2482642dfa --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,1257 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import jakarta.ws.rs.core.GenericType; + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.User; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FakeApi { + private ApiClient apiClient; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Health check endpoint + * + * @return HealthCheckResult + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public HealthCheckResult fakeHealthGet() throws ApiException { + return fakeHealthGetWithHttpInfo().getData(); + } + + /** + * Health check endpoint + * + * @return ApiResponse<HealthCheckResult> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public ApiResponse fakeHealthGetWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/health"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeApi.fakeHealthGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output boolean -
+ */ + public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { + return fakeOuterBooleanSerializeWithHttpInfo(body).getData(); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return ApiResponse<Boolean> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output boolean -
+ */ + public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeApi.fakeOuterBooleanSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output composite -
+ */ + public OuterComposite fakeOuterCompositeSerialize(OuterComposite outerComposite) throws ApiException { + return fakeOuterCompositeSerializeWithHttpInfo(outerComposite).getData(); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return ApiResponse<OuterComposite> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output composite -
+ */ + public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite outerComposite) throws ApiException { + Object localVarPostBody = outerComposite; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeApi.fakeOuterCompositeSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output number -
+ */ + public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { + return fakeOuterNumberSerializeWithHttpInfo(body).getData(); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return ApiResponse<BigDecimal> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output number -
+ */ + public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeApi.fakeOuterNumberSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output string -
+ */ + public String fakeOuterStringSerialize(String body) throws ApiException { + return fakeOuterStringSerializeWithHttpInfo(body).getData(); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output string -
+ */ + public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeApi.fakeOuterStringSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * Array of Enums + * + * @return List<OuterEnum> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public List getArrayOfEnums() throws ApiException { + return getArrayOfEnumsWithHttpInfo().getData(); + } + + /** + * Array of Enums + * + * @return ApiResponse<List<OuterEnum>> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public ApiResponse> getArrayOfEnumsWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/array-of-enums"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType> localVarReturnType = new GenericType>() {}; + + return apiClient.invokeAPI("FakeApi.getArrayOfEnums", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) throws ApiException { + testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass) throws ApiException { + Object localVarPostBody = fileSchemaTestClass; + + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) { + throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema"); + } + + // create path and map variables + String localVarPath = "/fake/body-with-file-schema"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testBodyWithFileSchema", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * + * + * @param query (required) + * @param user (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithQueryParams(String query, User user) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(query, user); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User user) throws ApiException { + Object localVarPostBody = user; + + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams"); + } + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testBodyWithQueryParams", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return Client + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClientModel(Client client) throws ApiException { + return testClientModelWithHttpInfo(client).getData(); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return ApiResponse<Client> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClientModelWithHttpInfo(Client client) throws ApiException { + Object localVarPostBody = client; + + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel"); + } + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeApi.testClientModel", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { + testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); + } + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); + } + + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) { + throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); + } + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + if (integer != null) + localVarFormParams.put("integer", integer); +if (int32 != null) + localVarFormParams.put("int32", int32); +if (int64 != null) + localVarFormParams.put("int64", int64); +if (number != null) + localVarFormParams.put("number", number); +if (_float != null) + localVarFormParams.put("float", _float); +if (_double != null) + localVarFormParams.put("double", _double); +if (string != null) + localVarFormParams.put("string", string); +if (patternWithoutDelimiter != null) + localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); +if (_byte != null) + localVarFormParams.put("byte", _byte); +if (binary != null) + localVarFormParams.put("binary", binary); +if (date != null) + localVarFormParams.put("date", date); +if (dateTime != null) + localVarFormParams.put("dateTime", dateTime); +if (password != null) + localVarFormParams.put("password", password); +if (paramCallback != null) + localVarFormParams.put("callback", paramCallback); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "http_basic_test" }; + + return apiClient.invokeAPI("FakeApi.testEndpointParameters", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { + testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "enum_query_string_array", enumQueryStringArray)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_string", enumQueryString)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_integer", enumQueryInteger)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_double", enumQueryDouble)); + + if (enumHeaderStringArray != null) + localVarHeaderParams.put("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); +if (enumHeaderString != null) + localVarHeaderParams.put("enum_header_string", apiClient.parameterToString(enumHeaderString)); + + + if (enumFormStringArray != null) + localVarFormParams.put("enum_form_string_array", enumFormStringArray); +if (enumFormString != null) + localVarFormParams.put("enum_form_string", enumFormString); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testEnumParameters", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + +private ApiResponse testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'requiredStringGroup' is set + if (requiredStringGroup == null) { + throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); + } + + // verify the required parameter 'requiredBooleanGroup' is set + if (requiredBooleanGroup == null) { + throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); + } + + // verify the required parameter 'requiredInt64Group' is set + if (requiredInt64Group == null) { + throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); + } + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_string_group", requiredStringGroup)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_int64_group", requiredInt64Group)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "string_group", stringGroup)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "int64_group", int64Group)); + + if (requiredBooleanGroup != null) + localVarHeaderParams.put("required_boolean_group", apiClient.parameterToString(requiredBooleanGroup)); +if (booleanGroup != null) + localVarHeaderParams.put("boolean_group", apiClient.parameterToString(booleanGroup)); + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "bearer_test" }; + + return apiClient.invokeAPI("FakeApi.testGroupParameters", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + + public class APItestGroupParametersRequest { + private Integer requiredStringGroup; + private Boolean requiredBooleanGroup; + private Long requiredInt64Group; + private Integer stringGroup; + private Boolean booleanGroup; + private Long int64Group; + + private APItestGroupParametersRequest() { + } + + /** + * Set requiredStringGroup + * @param requiredStringGroup Required String in group parameters (required) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest requiredStringGroup(Integer requiredStringGroup) { + this.requiredStringGroup = requiredStringGroup; + return this; + } + + /** + * Set requiredBooleanGroup + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest requiredBooleanGroup(Boolean requiredBooleanGroup) { + this.requiredBooleanGroup = requiredBooleanGroup; + return this; + } + + /** + * Set requiredInt64Group + * @param requiredInt64Group Required Integer in group parameters (required) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest requiredInt64Group(Long requiredInt64Group) { + this.requiredInt64Group = requiredInt64Group; + return this; + } + + /** + * Set stringGroup + * @param stringGroup String in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest stringGroup(Integer stringGroup) { + this.stringGroup = stringGroup; + return this; + } + + /** + * Set booleanGroup + * @param booleanGroup Boolean in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest booleanGroup(Boolean booleanGroup) { + this.booleanGroup = booleanGroup; + return this; + } + + /** + * Set int64Group + * @param int64Group Integer in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest int64Group(Long int64Group) { + this.int64Group = int64Group; + return this; + } + + /** + * Execute testGroupParameters request + + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Someting wrong -
+ + */ + + public void execute() throws ApiException { + this.executeWithHttpInfo().getData(); + } + + /** + * Execute testGroupParameters request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Someting wrong -
+ + */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @return testGroupParametersRequest + * @throws ApiException if fails to make API call + + + */ + public APItestGroupParametersRequest testGroupParameters() throws ApiException { + return new APItestGroupParametersRequest(); + } + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public void testInlineAdditionalProperties(Map requestBody) throws ApiException { + testInlineAdditionalPropertiesWithHttpInfo(requestBody); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map requestBody) throws ApiException { + Object localVarPostBody = requestBody; + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties"); + } + + // create path and map variables + String localVarPath = "/fake/inline-additionalProperties"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testInlineAdditionalProperties", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public void testJsonFormData(String param, String param2) throws ApiException { + testJsonFormDataWithHttpInfo(param, param2); + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'param' is set + if (param == null) { + throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); + } + + // verify the required parameter 'param2' is set + if (param2 == null) { + throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData"); + } + + // create path and map variables + String localVarPath = "/fake/jsonFormData"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + if (param != null) + localVarFormParams.put("param", param); +if (param2 != null) + localVarFormParams.put("param2", param2); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testJsonFormData", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
+ */ + public void testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) throws ApiException { + testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + } + + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'pipe' is set + if (pipe == null) { + throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) { + throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); + } + + // verify the required parameter 'http' is set + if (http == null) { + throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); + } + + // verify the required parameter 'url' is set + if (url == null) { + throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); + } + + // verify the required parameter 'context' is set + if (context == null) { + throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); + } + + // create path and map variables + String localVarPath = "/fake/test-query-parameters"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "pipe", pipe)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "ioutil", ioutil)); + localVarQueryParams.addAll(apiClient.parameterToPairs("ssv", "http", http)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "url", url)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "context", context)); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testQueryParameterCollectionFormat", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java new file mode 100644 index 000000000000..6aee09d3edd0 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,115 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import jakarta.ws.rs.core.GenericType; + +import org.openapitools.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FakeClassnameTags123Api { + private ApiClient apiClient; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @return Client + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClassname(Client client) throws ApiException { + return testClassnameWithHttpInfo(client).getData(); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @return ApiResponse<Client> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClassnameWithHttpInfo(Client client) throws ApiException { + Object localVarPostBody = client; + + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname"); + } + + // create path and map variables + String localVarPath = "/fake_classname_test"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key_query" }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeClassnameTags123Api.testClassname", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..42eb2a83dc14 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,697 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import jakarta.ws.rs.core.GenericType; + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PetApi { + private ApiClient apiClient; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
+ */ + public void addPet(Pet pet) throws ApiException { + addPetWithHttpInfo(pet); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse addPetWithHttpInfo(Pet pet) throws ApiException { + Object localVarPostBody = pet; + + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); + } + + // create path and map variables + String localVarPath = "/pet"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public void deletePet(Long petId, String apiKey) throws ApiException { + deletePetWithHttpInfo(petId, apiKey); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (apiKey != null) + localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.deletePet", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(List status) throws ApiException { + return findPetsByStatusWithHttpInfo(status).getData(); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + } + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + + GenericType> localVarReturnType = new GenericType>() {}; + + return apiClient.invokeAPI("PetApi.findPetsByStatus", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public List findPetsByTags(List tags) throws ApiException { + return findPetsByTagsWithHttpInfo(tags).getData(); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + } + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + + GenericType> localVarReturnType = new GenericType>() {}; + + return apiClient.invokeAPI("PetApi.findPetsByTags", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(Long petId) throws ApiException { + return getPetByIdWithHttpInfo(petId).getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key" }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("PetApi.getPetById", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public void updatePet(Pet pet) throws ApiException { + updatePetWithHttpInfo(pet); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public ApiResponse updatePetWithHttpInfo(Pet pet) throws ApiException { + Object localVarPostBody = pet; + + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); + } + + // create path and map variables + String localVarPath = "/pet"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(Long petId, String name, String status) throws ApiException { + updatePetWithFormWithHttpInfo(petId, name, status); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + if (name != null) + localVarFormParams.put("name", name); +if (status != null) + localVarFormParams.put("status", status); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.updatePetWithForm", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File _file) throws ApiException { + return uploadFileWithHttpInfo(petId, additionalMetadata, _file).getData(); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File _file) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + if (additionalMetadata != null) + localVarFormParams.put("additionalMetadata", additionalMetadata); +if (_file != null) + localVarFormParams.put("file", _file); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("PetApi.uploadFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return ModelApiResponse + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws ApiException { + return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata).getData(); + } + + /** + * uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); + } + + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) { + throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); + } + + // create path and map variables + String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + if (additionalMetadata != null) + localVarFormParams.put("additionalMetadata", additionalMetadata); +if (requiredFile != null) + localVarFormParams.put("requiredFile", requiredFile); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("PetApi.uploadFileWithRequiredFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..0f4dd5cf858a --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,316 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import jakarta.ws.rs.core.GenericType; + +import org.openapitools.client.model.Order; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StoreApi { + private ApiClient apiClient; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(String orderId) throws ApiException { + deleteOrderWithHttpInfo(orderId); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + } + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("StoreApi.deleteOrder", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public Map getInventory() throws ApiException { + return getInventoryWithHttpInfo().getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key" }; + + GenericType> localVarReturnType = new GenericType>() {}; + + return apiClient.invokeAPI("StoreApi.getInventory", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(Long orderId) throws ApiException { + return getOrderByIdWithHttpInfo(orderId).getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + } + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("StoreApi.getOrderById", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(Order order) throws ApiException { + return placeOrderWithHttpInfo(order).getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(Order order) throws ApiException { + Object localVarPostBody = order; + + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); + } + + // create path and map variables + String localVarPath = "/store/order"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("StoreApi.placeOrder", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..c23402c300bd --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,589 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import jakarta.ws.rs.core.GenericType; + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UserApi { + private ApiClient apiClient; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(User user) throws ApiException { + createUserWithHttpInfo(user); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUserWithHttpInfo(User user) throws ApiException { + Object localVarPostBody = user; + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); + } + + // create path and map variables + String localVarPath = "/user"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.createUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(List user) throws ApiException { + createUsersWithArrayInputWithHttpInfo(user); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(List user) throws ApiException { + Object localVarPostBody = user; + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); + } + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.createUsersWithArrayInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(List user) throws ApiException { + createUsersWithListInputWithHttpInfo(user); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(List user) throws ApiException { + Object localVarPostBody = user; + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); + } + + // create path and map variables + String localVarPath = "/user/createWithList"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.createUsersWithListInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(String username) throws ApiException { + deleteUserWithHttpInfo(username); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + } + + // create path and map variables + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.deleteUser", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(String username) throws ApiException { + return getUserByNameWithHttpInfo(username).getData(); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return ApiResponse<User> + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + } + + // create path and map variables + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("UserApi.getUserByName", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return String + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
+ */ + public String loginUser(String username, String password) throws ApiException { + return loginUserWithHttpInfo(username, password).getData(); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
+ */ + public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + } + + // create path and map variables + String localVarPath = "/user/login"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password)); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("UserApi.loginUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, false); + } + /** + * Logs out current logged in user session + * + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public void logoutUser() throws ApiException { + logoutUserWithHttpInfo(); + } + + /** + * Logs out current logged in user session + * + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.logoutUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(String username, User user) throws ApiException { + updateUserWithHttpInfo(username, user); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(String username, User user) throws ApiException { + Object localVarPostBody = user; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); + } + + // create path and map variables + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.updateUser", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, false); + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..6b7c05426439 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,79 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..579b5e0d6d53 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; + +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..b49dd09b98d4 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + +import java.util.Base64; +import java.nio.charset.StandardCharsets; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + if (username == null && password == null) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..1e07e27e4f97 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class HttpBearerAuth implements Authentication { + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return bearerToken; + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + if(bearerToken == null) { + return; + } + + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java new file mode 100644 index 000000000000..18274e1df9ec --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java @@ -0,0 +1,280 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + +import java.net.URI; +import java.net.URLEncoder; +import java.security.MessageDigest; +import java.security.Key; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.List; +import java.util.TimeZone; +import java.security.spec.AlgorithmParameterSpec; +import java.security.InvalidKeyException; + +import org.tomitribe.auth.signatures.Algorithm; +import org.tomitribe.auth.signatures.Signer; +import org.tomitribe.auth.signatures.Signature; +import org.tomitribe.auth.signatures.SigningAlgorithm; + +/** + * A Configuration object for the HTTP message signature security scheme. + */ +public class HttpSignatureAuth implements Authentication { + + private Signer signer; + + // An opaque string that the server can use to look up the component they need to validate the signature. + private String keyId; + + // The HTTP signature algorithm. + private SigningAlgorithm signingAlgorithm; + + // The HTTP cryptographic algorithm. + private Algorithm algorithm; + + // The cryptographic parameters. + private AlgorithmParameterSpec parameterSpec; + + // The list of HTTP headers that should be included in the HTTP signature. + private List headers; + + // The digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + private String digestAlgorithm; + + // The maximum validity duration of the HTTP signature. + private Long maxSignatureValidity; + + /** + * Construct a new HTTP signature auth configuration object. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + * @param signingAlgorithm The signature algorithm. + * @param algorithm The cryptographic algorithm. + * @param digestAlgorithm The digest algorithm. + * @param headers The list of HTTP headers that should be included in the HTTP signature. + * @param maxSignatureValidity The maximum validity duration of the HTTP signature. + * Used to set the '(expires)' field in the HTTP signature. + */ + public HttpSignatureAuth(String keyId, + SigningAlgorithm signingAlgorithm, + Algorithm algorithm, + String digestAlgorithm, + AlgorithmParameterSpec parameterSpec, + List headers, + Long maxSignatureValidity) { + this.keyId = keyId; + this.signingAlgorithm = signingAlgorithm; + this.algorithm = algorithm; + this.parameterSpec = parameterSpec; + this.digestAlgorithm = digestAlgorithm; + this.headers = headers; + this.maxSignatureValidity = maxSignatureValidity; + } + + /** + * Returns the opaque string that the server can use to look up the component they need to validate the signature. + * + * @return The keyId. + */ + public String getKeyId() { + return keyId; + } + + /** + * Set the HTTP signature key id. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + */ + public void setKeyId(String keyId) { + this.keyId = keyId; + } + + /** + * Returns the HTTP signature algorithm which is used to sign HTTP requests. + */ + public SigningAlgorithm getSigningAlgorithm() { + return signingAlgorithm; + } + + /** + * Sets the HTTP signature algorithm which is used to sign HTTP requests. + * + * @param signingAlgorithm The HTTP signature algorithm. + */ + public void setSigningAlgorithm(SigningAlgorithm signingAlgorithm) { + this.signingAlgorithm = signingAlgorithm; + } + + /** + * Returns the HTTP cryptographic algorithm which is used to sign HTTP requests. + */ + public Algorithm getAlgorithm() { + return algorithm; + } + + /** + * Sets the HTTP cryptographic algorithm which is used to sign HTTP requests. + * + * @param algorithm The HTTP signature algorithm. + */ + public void setAlgorithm(Algorithm algorithm) { + this.algorithm = algorithm; + } + + /** + * Returns the cryptographic parameters which are used to sign HTTP requests. + */ + public AlgorithmParameterSpec getAlgorithmParameterSpec() { + return parameterSpec; + } + + /** + * Sets the cryptographic parameters which are used to sign HTTP requests. + * + * @param parameterSpec The cryptographic parameters. + */ + public void setAlgorithmParameterSpec(AlgorithmParameterSpec parameterSpec) { + this.parameterSpec = parameterSpec; + } + + /** + * Returns the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * @see java.security.MessageDigest + */ + public String getDigestAlgorithm() { + return digestAlgorithm; + } + + /** + * Sets the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * The exact list of supported digest algorithms depends on the installed security providers. + * Every implementation of the Java platform is required to support "MD5", "SHA-1" and "SHA-256". + * Do not use "MD5" and "SHA-1", they are vulnerable to multiple known attacks. + * By default, "SHA-256" is used. + * + * @param digestAlgorithm The digest algorithm. + * + * @see java.security.MessageDigest + */ + public void setDigestAlgorithm(String digestAlgorithm) { + this.digestAlgorithm = digestAlgorithm; + } + + /** + * Returns the list of HTTP headers that should be included in the HTTP signature. + */ + public List getHeaders() { + return headers; + } + + /** + * Sets the list of HTTP headers that should be included in the HTTP signature. + * + * @param headers The HTTP headers. + */ + public void setHeaders(List headers) { + this.headers = headers; + } + + /** + * Returns the maximum validity duration of the HTTP signature. + * @return The maximum validity duration of the HTTP signature. + */ + public Long getMaxSignatureValidity() { + return maxSignatureValidity; + } + + /** + * Returns the signer instance used to sign HTTP messages. + * + * @return the signer instance. + */ + public Signer getSigner() { + return signer; + } + + /** + * Sets the signer instance used to sign HTTP messages. + * + * @param signer The signer instance to set. + */ + public void setSigner(Signer signer) { + this.signer = signer; + } + + /** + * Set the private key used to sign HTTP requests using the HTTP signature scheme. + * + * @param key The private key. + * + * @throws InvalidKeyException Unable to parse the key, or the security provider for this key + * is not installed. + */ + public void setPrivateKey(Key key) throws InvalidKeyException, ApiException { + if (key == null) { + throw new ApiException("Private key (java.security.Key) cannot be null"); + } + signer = new Signer(key, new Signature(keyId, signingAlgorithm, algorithm, parameterSpec, null, headers, maxSignatureValidity)); + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + try { + if (headers.contains("host")) { + headerParams.put("host", uri.getHost()); + } + + if (headers.contains("date")) { + SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); + dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); + headerParams.put("date", dateFormat.format(Calendar.getInstance().getTime())); + } + + if (headers.contains("digest")) { + headerParams.put("digest", + this.digestAlgorithm + "=" + + new String(Base64.getEncoder().encode(MessageDigest.getInstance(this.digestAlgorithm).digest(payload.getBytes())))); + } + + if (signer == null) { + throw new ApiException("Signer cannot be null. Please call the method `setPrivateKey` to set it up correctly"); + } + + // construct the path with the URL-encoded path and query. + // Calling getRawPath and getRawQuery ensures the path is URL-encoded as it will be serialized + // on the wire. The HTTP signature must use the encode URL as it is sent on the wire. + String path = uri.getRawPath(); + if (uri.getRawQuery() != null && !"".equals(uri.getRawQuery())) { + path += "?" + uri.getRawQuery(); + } + + headerParams.put("Authorization", signer.sign(method, path, headerParams).toString()); + } catch (Exception ex) { + throw new ApiException("Failed to create signature in the HTTP request header: " + ex.toString()); + } + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..7d6650900347 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,193 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.exceptions.OAuthException; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.oauth.OAuth20Service; + +import jakarta.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OAuth implements Authentication { + private static final Logger log = Logger.getLogger(OAuth.class.getName()); + + private String tokenUrl; + private String absoluteTokenUrl; + private OAuthFlow flow = OAuthFlow.APPLICATION; + private OAuth20Service service; + private DefaultApi20 authApi; + private String scope; + private String username; + private String password; + private String code; + private volatile OAuth2AccessToken accessToken; + + public OAuth(String basePath, String tokenUrl) { + this.tokenUrl = tokenUrl; + this.absoluteTokenUrl = createAbsoluteTokenUrl(basePath, tokenUrl); + authApi = new DefaultApi20() { + @Override + public String getAccessTokenEndpoint() { + return absoluteTokenUrl; + } + + @Override + protected String getAuthorizationBaseUrl() { + throw new UnsupportedOperationException("Shouldn't get there !"); + } + }; + } + + private static String createAbsoluteTokenUrl(String basePath, String tokenUrl) { + if (!URI.create(tokenUrl).isAbsolute()) { + try { + return UriBuilder.fromPath(basePath).path(tokenUrl).build().toURL().toString(); + } catch (MalformedURLException e) { + log.log(Level.SEVERE, "Couldn't create absolute token URL", e); + } + } + return tokenUrl; + } + + @Override + public void applyToParams( + List queryParams, + Map headerParams, + Map cookieParams, + String payload, + String method, + URI uri) + throws ApiException { + + if (accessToken == null) { + obtainAccessToken(null); + } + if (accessToken != null) { + headerParams.put("Authorization", "Bearer " + accessToken.getAccessToken()); + } + } + + public OAuth2AccessToken renewAccessToken() throws ApiException { + String refreshToken = null; + if (accessToken != null) { + refreshToken = accessToken.getRefreshToken(); + accessToken = null; + } + return obtainAccessToken(refreshToken); + } + + public synchronized OAuth2AccessToken obtainAccessToken(String refreshToken) throws ApiException { + if (service == null) { + log.log(Level.FINE, "service is null in obtainAccessToken."); + return null; + } + try { + if (refreshToken != null) { + return service.refreshAccessToken(refreshToken); + } + } catch (OAuthException | InterruptedException | ExecutionException | IOException e) { + log.log(Level.FINE, "Refreshing the access token using the refresh token failed", e); + } + try { + switch (flow) { + case PASSWORD: + if (username != null && password != null) { + accessToken = service.getAccessTokenPasswordGrant(username, password, scope); + } + break; + case ACCESS_CODE: + if (code != null) { + accessToken = service.getAccessToken(code); + code = null; + } + break; + case APPLICATION: + accessToken = service.getAccessTokenClientCredentialsGrant(scope); + break; + default: + log.log(Level.SEVERE, "Invalid flow in obtainAccessToken: " + flow); + } + } catch (OAuthException | InterruptedException | ExecutionException | IOException e) { + throw new ApiException(e); + } + return accessToken; + } + + public OAuth2AccessToken getAccessToken() { + return accessToken; + } + + public OAuth setAccessToken(OAuth2AccessToken accessToken) { + this.accessToken = accessToken; + return this; + } + + public OAuth setAccessToken(String accessToken) { + this.accessToken = new OAuth2AccessToken(accessToken); + return this; + } + + public OAuth setScope(String scope) { + this.scope = scope; + return this; + } + + public OAuth setCredentials(String clientId, String clientSecret, Boolean debug) { + if (Boolean.TRUE.equals(debug)) { + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret).debug() + .build(authApi); + } else { + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .build(authApi); + } + return this; + } + + public OAuth usePasswordFlow(String username, String password) { + this.flow = OAuthFlow.PASSWORD; + this.username = username; + this.password = password; + return this; + } + + public OAuth useAuthorizationCodeFlow(String code) { + this.flow = OAuthFlow.ACCESS_CODE; + this.code = code; + return this; + } + + public OAuth setFlow(OAuthFlow flow) { + this.flow = flow; + return this; + } + + public void setBasePath(String basePath) { + this.absoluteTokenUrl = createAbsoluteTokenUrl(basePath, tokenUrl); + } +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..dab6bf989ea7 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,24 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +/** + * OAuth flows that are supported by this client + */ +public enum OAuthFlow { + ACCESS_CODE, + IMPLICIT, + PASSWORD, + APPLICATION +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..f837dea9fdd9 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,149 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.openapitools.client.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; +import jakarta.ws.rs.core.GenericType; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + @JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).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 boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..5962b1ea54c7 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,394 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * AdditionalPropertiesClass + */ +@JsonPropertyOrder({ + AdditionalPropertiesClass.JSON_PROPERTY_MAP_PROPERTY, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_OF_MAP_PROPERTY, + AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE1, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3, + AdditionalPropertiesClass.JSON_PROPERTY_EMPTY_MAP, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AdditionalPropertiesClass { + public static final String JSON_PROPERTY_MAP_PROPERTY = "map_property"; + private Map mapProperty = null; + + public static final String JSON_PROPERTY_MAP_OF_MAP_PROPERTY = "map_of_map_property"; + private Map> mapOfMapProperty = null; + + public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1"; + private JsonNullable anytype1 = JsonNullable.of(null); + + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1 = "map_with_undeclared_properties_anytype_1"; + private Object mapWithUndeclaredPropertiesAnytype1; + + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2 = "map_with_undeclared_properties_anytype_2"; + private Object mapWithUndeclaredPropertiesAnytype2; + + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3 = "map_with_undeclared_properties_anytype_3"; + private Map mapWithUndeclaredPropertiesAnytype3 = null; + + public static final String JSON_PROPERTY_EMPTY_MAP = "empty_map"; + private Object emptyMap; + + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING = "map_with_undeclared_properties_string"; + private Map mapWithUndeclaredPropertiesString = null; + + public AdditionalPropertiesClass() { + } + + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return this; + } + + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap<>(); + } + this.mapProperty.put(key, mapPropertyItem); + return this; + } + + /** + * Get mapProperty + * @return mapProperty + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapProperty() { + return mapProperty; + } + + + @JsonProperty(JSON_PROPERTY_MAP_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap<>(); + } + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); + return this; + } + + /** + * Get mapOfMapProperty + * @return mapOfMapProperty + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_OF_MAP_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + + @JsonProperty(JSON_PROPERTY_MAP_OF_MAP_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + public AdditionalPropertiesClass anytype1(Object anytype1) { + this.anytype1 = JsonNullable.of(anytype1); + return this; + } + + /** + * Get anytype1 + * @return anytype1 + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Object getAnytype1() { + return anytype1.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ANYTYPE1) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAnytype1_JsonNullable() { + return anytype1; + } + + @JsonProperty(JSON_PROPERTY_ANYTYPE1) + public void setAnytype1_JsonNullable(JsonNullable anytype1) { + this.anytype1 = anytype1; + } + + public void setAnytype1(Object anytype1) { + this.anytype1 = JsonNullable.of(anytype1); + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype1(Object mapWithUndeclaredPropertiesAnytype1) { + this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; + return this; + } + + /** + * Get mapWithUndeclaredPropertiesAnytype1 + * @return mapWithUndeclaredPropertiesAnytype1 + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getMapWithUndeclaredPropertiesAnytype1() { + return mapWithUndeclaredPropertiesAnytype1; + } + + + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapWithUndeclaredPropertiesAnytype1(Object mapWithUndeclaredPropertiesAnytype1) { + this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype2(Object mapWithUndeclaredPropertiesAnytype2) { + this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; + return this; + } + + /** + * Get mapWithUndeclaredPropertiesAnytype2 + * @return mapWithUndeclaredPropertiesAnytype2 + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getMapWithUndeclaredPropertiesAnytype2() { + return mapWithUndeclaredPropertiesAnytype2; + } + + + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapWithUndeclaredPropertiesAnytype2(Object mapWithUndeclaredPropertiesAnytype2) { + this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype3(Map mapWithUndeclaredPropertiesAnytype3) { + this.mapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; + return this; + } + + public AdditionalPropertiesClass putMapWithUndeclaredPropertiesAnytype3Item(String key, Object mapWithUndeclaredPropertiesAnytype3Item) { + if (this.mapWithUndeclaredPropertiesAnytype3 == null) { + this.mapWithUndeclaredPropertiesAnytype3 = new HashMap<>(); + } + this.mapWithUndeclaredPropertiesAnytype3.put(key, mapWithUndeclaredPropertiesAnytype3Item); + return this; + } + + /** + * Get mapWithUndeclaredPropertiesAnytype3 + * @return mapWithUndeclaredPropertiesAnytype3 + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapWithUndeclaredPropertiesAnytype3() { + return mapWithUndeclaredPropertiesAnytype3; + } + + + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public void setMapWithUndeclaredPropertiesAnytype3(Map mapWithUndeclaredPropertiesAnytype3) { + this.mapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; + } + + + public AdditionalPropertiesClass emptyMap(Object emptyMap) { + this.emptyMap = emptyMap; + return this; + } + + /** + * an object with no declared properties and no undeclared properties, hence it's an empty map. + * @return emptyMap + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "an object with no declared properties and no undeclared properties, hence it's an empty map.") + @JsonProperty(JSON_PROPERTY_EMPTY_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getEmptyMap() { + return emptyMap; + } + + + @JsonProperty(JSON_PROPERTY_EMPTY_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmptyMap(Object emptyMap) { + this.emptyMap = emptyMap; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesString(Map mapWithUndeclaredPropertiesString) { + this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; + return this; + } + + public AdditionalPropertiesClass putMapWithUndeclaredPropertiesStringItem(String key, String mapWithUndeclaredPropertiesStringItem) { + if (this.mapWithUndeclaredPropertiesString == null) { + this.mapWithUndeclaredPropertiesString = new HashMap<>(); + } + this.mapWithUndeclaredPropertiesString.put(key, mapWithUndeclaredPropertiesStringItem); + return this; + } + + /** + * Get mapWithUndeclaredPropertiesString + * @return mapWithUndeclaredPropertiesString + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapWithUndeclaredPropertiesString() { + return mapWithUndeclaredPropertiesString; + } + + + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapWithUndeclaredPropertiesString(Map mapWithUndeclaredPropertiesString) { + this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; + } + + + /** + * Return true if this AdditionalPropertiesClass object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty) && + equalsNullable(this.anytype1, additionalPropertiesClass.anytype1) && + Objects.equals(this.mapWithUndeclaredPropertiesAnytype1, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype1) && + Objects.equals(this.mapWithUndeclaredPropertiesAnytype2, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype2) && + Objects.equals(this.mapWithUndeclaredPropertiesAnytype3, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype3) && + Objects.equals(this.emptyMap, additionalPropertiesClass.emptyMap) && + Objects.equals(this.mapWithUndeclaredPropertiesString, additionalPropertiesClass.mapWithUndeclaredPropertiesString); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty, hashCodeNullable(anytype1), mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, emptyMap, mapWithUndeclaredPropertiesString); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); + sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n"); + sb.append(" mapWithUndeclaredPropertiesAnytype1: ").append(toIndentedString(mapWithUndeclaredPropertiesAnytype1)).append("\n"); + sb.append(" mapWithUndeclaredPropertiesAnytype2: ").append(toIndentedString(mapWithUndeclaredPropertiesAnytype2)).append("\n"); + sb.append(" mapWithUndeclaredPropertiesAnytype3: ").append(toIndentedString(mapWithUndeclaredPropertiesAnytype3)).append("\n"); + sb.append(" emptyMap: ").append(toIndentedString(emptyMap)).append("\n"); + sb.append(" mapWithUndeclaredPropertiesString: ").append(toIndentedString(mapWithUndeclaredPropertiesString)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 000000000000..f45ed42cfc25 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Animal.java @@ -0,0 +1,167 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Animal + */ +@JsonPropertyOrder({ + Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_COLOR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonIgnoreProperties( + value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the className to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = Dog.class, name = "Dog"), +}) + +public class Animal { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + private String className; + + public static final String JSON_PROPERTY_COLOR = "color"; + private String color = "red"; + + public Animal() { + } + + public Animal className(String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(String className) { + this.className = className; + } + + + public Animal color(String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getColor() { + return color; + } + + + @JsonProperty(JSON_PROPERTY_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setColor(String color) { + this.color = color; + } + + + /** + * Return true if this Animal object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).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 "); + } + +static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Cat", Cat.class); + mappings.put("Dog", Dog.class); + mappings.put("Animal", Animal.class); + JSON.registerDiscriminator(Animal.class, "className", mappings); +} +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Apple.java new file mode 100644 index 000000000000..c8904088a0df --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Apple.java @@ -0,0 +1,145 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Apple + */ +@JsonPropertyOrder({ + Apple.JSON_PROPERTY_CULTIVAR, + Apple.JSON_PROPERTY_ORIGIN +}) +@JsonTypeName("apple") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Apple { + public static final String JSON_PROPERTY_CULTIVAR = "cultivar"; + private String cultivar; + + public static final String JSON_PROPERTY_ORIGIN = "origin"; + private String origin; + + public Apple() { + } + + public Apple cultivar(String cultivar) { + this.cultivar = cultivar; + return this; + } + + /** + * Get cultivar + * @return cultivar + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CULTIVAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCultivar() { + return cultivar; + } + + + @JsonProperty(JSON_PROPERTY_CULTIVAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCultivar(String cultivar) { + this.cultivar = cultivar; + } + + + public Apple origin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get origin + * @return origin + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ORIGIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getOrigin() { + return origin; + } + + + @JsonProperty(JSON_PROPERTY_ORIGIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOrigin(String origin) { + this.origin = origin; + } + + + /** + * Return true if this apple object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Apple apple = (Apple) o; + return Objects.equals(this.cultivar, apple.cultivar) && + Objects.equals(this.origin, apple.origin); + } + + @Override + public int hashCode() { + return Objects.hash(cultivar, origin); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Apple {\n"); + sb.append(" cultivar: ").append(toIndentedString(cultivar)).append("\n"); + sb.append(" origin: ").append(toIndentedString(origin)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AppleReq.java new file mode 100644 index 000000000000..101f74fad8f6 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AppleReq.java @@ -0,0 +1,145 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * AppleReq + */ +@JsonPropertyOrder({ + AppleReq.JSON_PROPERTY_CULTIVAR, + AppleReq.JSON_PROPERTY_MEALY +}) +@JsonTypeName("appleReq") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AppleReq { + public static final String JSON_PROPERTY_CULTIVAR = "cultivar"; + private String cultivar; + + public static final String JSON_PROPERTY_MEALY = "mealy"; + private Boolean mealy; + + public AppleReq() { + } + + public AppleReq cultivar(String cultivar) { + this.cultivar = cultivar; + return this; + } + + /** + * Get cultivar + * @return cultivar + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CULTIVAR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getCultivar() { + return cultivar; + } + + + @JsonProperty(JSON_PROPERTY_CULTIVAR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCultivar(String cultivar) { + this.cultivar = cultivar; + } + + + public AppleReq mealy(Boolean mealy) { + this.mealy = mealy; + return this; + } + + /** + * Get mealy + * @return mealy + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MEALY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMealy() { + return mealy; + } + + + @JsonProperty(JSON_PROPERTY_MEALY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMealy(Boolean mealy) { + this.mealy = mealy; + } + + + /** + * Return true if this appleReq object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppleReq appleReq = (AppleReq) o; + return Objects.equals(this.cultivar, appleReq.cultivar) && + Objects.equals(this.mealy, appleReq.mealy); + } + + @Override + public int hashCode() { + return Objects.hash(cultivar, mealy); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppleReq {\n"); + sb.append(" cultivar: ").append(toIndentedString(cultivar)).append("\n"); + sb.append(" mealy: ").append(toIndentedString(mealy)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..c5af5b29fe95 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,123 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * ArrayOfArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ArrayOfArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + private List> arrayArrayNumber = null; + + public ArrayOfArrayOfNumberOnly() { + } + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { + if (this.arrayArrayNumber == null) { + this.arrayArrayNumber = new ArrayList<>(); + } + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + /** + * Get arrayArrayNumber + * @return arrayArrayNumber + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + + /** + * Return true if this ArrayOfArrayOfNumberOnly object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..45026879e868 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -0,0 +1,123 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * ArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber"; + private List arrayNumber = null; + + public ArrayOfNumberOnly() { + } + + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return this; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + if (this.arrayNumber == null) { + this.arrayNumber = new ArrayList<>(); + } + this.arrayNumber.add(arrayNumberItem); + return this; + } + + /** + * Get arrayNumber + * @return arrayNumber + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayNumber() { + return arrayNumber; + } + + + @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + + /** + * Return true if this ArrayOfNumberOnly object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayTest.java new file mode 100644 index 000000000000..b3f3f20192b6 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -0,0 +1,203 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * ArrayTest + */ +@JsonPropertyOrder({ + ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ArrayTest { + public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string"; + private List arrayOfString = null; + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + private List> arrayArrayOfInteger = null; + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + private List> arrayArrayOfModel = null; + + public ArrayTest() { + } + + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + if (this.arrayOfString == null) { + this.arrayOfString = new ArrayList<>(); + } + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + /** + * Get arrayOfString + * @return arrayOfString + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayOfString() { + return arrayOfString; + } + + + @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (this.arrayArrayOfInteger == null) { + this.arrayArrayOfInteger = new ArrayList<>(); + } + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + /** + * Get arrayArrayOfInteger + * @return arrayArrayOfInteger + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { + if (this.arrayArrayOfModel == null) { + this.arrayArrayOfModel = new ArrayList<>(); + } + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + /** + * Get arrayArrayOfModel + * @return arrayArrayOfModel + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + /** + * Return true if this ArrayTest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Banana.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Banana.java new file mode 100644 index 000000000000..e7a63fd3adf9 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Banana.java @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Banana + */ +@JsonPropertyOrder({ + Banana.JSON_PROPERTY_LENGTH_CM +}) +@JsonTypeName("banana") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Banana { + public static final String JSON_PROPERTY_LENGTH_CM = "lengthCm"; + private BigDecimal lengthCm; + + public Banana() { + } + + public Banana lengthCm(BigDecimal lengthCm) { + this.lengthCm = lengthCm; + return this; + } + + /** + * Get lengthCm + * @return lengthCm + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LENGTH_CM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getLengthCm() { + return lengthCm; + } + + + @JsonProperty(JSON_PROPERTY_LENGTH_CM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLengthCm(BigDecimal lengthCm) { + this.lengthCm = lengthCm; + } + + + /** + * Return true if this banana object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Banana banana = (Banana) o; + return Objects.equals(this.lengthCm, banana.lengthCm); + } + + @Override + public int hashCode() { + return Objects.hash(lengthCm); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Banana {\n"); + sb.append(" lengthCm: ").append(toIndentedString(lengthCm)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/BananaReq.java new file mode 100644 index 000000000000..d25642d46098 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/BananaReq.java @@ -0,0 +1,146 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * BananaReq + */ +@JsonPropertyOrder({ + BananaReq.JSON_PROPERTY_LENGTH_CM, + BananaReq.JSON_PROPERTY_SWEET +}) +@JsonTypeName("bananaReq") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BananaReq { + public static final String JSON_PROPERTY_LENGTH_CM = "lengthCm"; + private BigDecimal lengthCm; + + public static final String JSON_PROPERTY_SWEET = "sweet"; + private Boolean sweet; + + public BananaReq() { + } + + public BananaReq lengthCm(BigDecimal lengthCm) { + this.lengthCm = lengthCm; + return this; + } + + /** + * Get lengthCm + * @return lengthCm + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_LENGTH_CM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getLengthCm() { + return lengthCm; + } + + + @JsonProperty(JSON_PROPERTY_LENGTH_CM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setLengthCm(BigDecimal lengthCm) { + this.lengthCm = lengthCm; + } + + + public BananaReq sweet(Boolean sweet) { + this.sweet = sweet; + return this; + } + + /** + * Get sweet + * @return sweet + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SWEET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getSweet() { + return sweet; + } + + + @JsonProperty(JSON_PROPERTY_SWEET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSweet(Boolean sweet) { + this.sweet = sweet; + } + + + /** + * Return true if this bananaReq object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BananaReq bananaReq = (BananaReq) o; + return Objects.equals(this.lengthCm, bananaReq.lengthCm) && + Objects.equals(this.sweet, bananaReq.sweet); + } + + @Override + public int hashCode() { + return Objects.hash(lengthCm, sweet); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BananaReq {\n"); + sb.append(" lengthCm: ").append(toIndentedString(lengthCm)).append("\n"); + sb.append(" sweet: ").append(toIndentedString(sweet)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/BasquePig.java new file mode 100644 index 000000000000..4c09c9cea50f --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/BasquePig.java @@ -0,0 +1,112 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * BasquePig + */ +@JsonPropertyOrder({ + BasquePig.JSON_PROPERTY_CLASS_NAME +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BasquePig { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + private String className; + + public BasquePig() { + } + + public BasquePig className(String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(String className) { + this.className = className; + } + + + /** + * Return true if this BasquePig object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BasquePig basquePig = (BasquePig) o; + return Objects.equals(this.className, basquePig.className); + } + + @Override + public int hashCode() { + return Objects.hash(className); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BasquePig {\n"); + sb.append(" className: ").append(toIndentedString(className)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Capitalization.java new file mode 100644 index 000000000000..35f10af74b73 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Capitalization.java @@ -0,0 +1,272 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Capitalization + */ +@JsonPropertyOrder({ + Capitalization.JSON_PROPERTY_SMALL_CAMEL, + Capitalization.JSON_PROPERTY_CAPITAL_CAMEL, + Capitalization.JSON_PROPERTY_SMALL_SNAKE, + Capitalization.JSON_PROPERTY_CAPITAL_SNAKE, + Capitalization.JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, + Capitalization.JSON_PROPERTY_A_T_T_N_A_M_E +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Capitalization { + public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel"; + private String smallCamel; + + public static final String JSON_PROPERTY_CAPITAL_CAMEL = "CapitalCamel"; + private String capitalCamel; + + public static final String JSON_PROPERTY_SMALL_SNAKE = "small_Snake"; + private String smallSnake; + + public static final String JSON_PROPERTY_CAPITAL_SNAKE = "Capital_Snake"; + private String capitalSnake; + + public static final String JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + private String scAETHFlowPoints; + + public static final String JSON_PROPERTY_A_T_T_N_A_M_E = "ATT_NAME"; + private String ATT_NAME; + + public Capitalization() { + } + + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SMALL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSmallCamel() { + return smallCamel; + } + + + @JsonProperty(JSON_PROPERTY_SMALL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CAPITAL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCapitalCamel() { + return capitalCamel; + } + + + @JsonProperty(JSON_PROPERTY_CAPITAL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SMALL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSmallSnake() { + return smallSnake; + } + + + @JsonProperty(JSON_PROPERTY_SMALL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CAPITAL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCapitalSnake() { + return capitalSnake; + } + + + @JsonProperty(JSON_PROPERTY_CAPITAL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + + @JsonProperty(JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "Name of the pet ") + @JsonProperty(JSON_PROPERTY_A_T_T_N_A_M_E) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getATTNAME() { + return ATT_NAME; + } + + + @JsonProperty(JSON_PROPERTY_A_T_T_N_A_M_E) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + /** + * Return true if this Capitalization object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 000000000000..a3d569c46d44 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,174 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Animal; +import org.openapitools.client.model.CatAllOf; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Cat + */ +@JsonPropertyOrder({ + Cat.JSON_PROPERTY_DECLAWED +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonIgnoreProperties( + value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the className to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) + +public class Cat extends Animal { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + private Boolean declawed; + + public Cat() { + } + + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDeclawed() { + return declawed; + } + + + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + /** + * 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. + */ + @JsonAnySetter + public Cat 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this Cat object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed)&& + Objects.equals(this.additionalProperties, cat.additionalProperties) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode(), additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).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 "); + } + +static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Cat", Cat.class); + JSON.registerDiscriminator(Cat.class, "className", mappings); +} +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/CatAllOf.java new file mode 100644 index 000000000000..fe3a2613254e --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -0,0 +1,113 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * CatAllOf + */ +@JsonPropertyOrder({ + CatAllOf.JSON_PROPERTY_DECLAWED +}) +@JsonTypeName("Cat_allOf") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CatAllOf { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + private Boolean declawed; + + public CatAllOf() { + } + + public CatAllOf declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDeclawed() { + return declawed; + } + + + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + /** + * Return true if this Cat_allOf object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatAllOf catAllOf = (CatAllOf) o; + return Objects.equals(this.declawed, catAllOf.declawed); + } + + @Override + public int hashCode() { + return Objects.hash(declawed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatAllOf {\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..ea13668b6aeb --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,144 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Category + */ +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +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 = "default-name"; + + public Category() { + } + + public Category id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + + public Category name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(String name) { + this.name = name; + } + + + /** + * Return true if this Category object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @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 String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ChildCat.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ChildCat.java new file mode 100644 index 000000000000..c5bec7fb9de2 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ChildCat.java @@ -0,0 +1,220 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ChildCatAllOf; +import org.openapitools.client.model.ParentPet; +import java.util.Set; +import java.util.HashSet; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * ChildCat + */ +@JsonPropertyOrder({ + ChildCat.JSON_PROPERTY_NAME, + ChildCat.JSON_PROPERTY_PET_TYPE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonIgnoreProperties( + value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the pet_type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true) + +public class ChildCat extends ParentPet { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PET_TYPE = "pet_type"; + private String petType = "ChildCat"; + + public ChildCat() { + } + + public ChildCat name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + + public static final Set PET_TYPE_VALUES = new HashSet<>(Arrays.asList( + "ChildCat" + )); + + public ChildCat petType(String petType) { + if (!PET_TYPE_VALUES.contains(petType)) { + throw new IllegalArgumentException(petType + " is invalid. Possible values for petType: " + String.join(", ", PET_TYPE_VALUES)); + } + + this.petType = petType; + return this; + } + + /** + * Get petType + * @return petType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PET_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPetType() { + return petType; + } + + + @JsonProperty(JSON_PROPERTY_PET_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPetType(String petType) { + if (!PET_TYPE_VALUES.contains(petType)) { + throw new IllegalArgumentException(petType + " is invalid. Possible values for petType: " + String.join(", ", PET_TYPE_VALUES)); + } + + this.petType = petType; + } + + /** + * 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. + */ + @JsonAnySetter + public ChildCat 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this ChildCat object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChildCat childCat = (ChildCat) o; + return Objects.equals(this.name, childCat.name) && + Objects.equals(this.petType, childCat.petType)&& + Objects.equals(this.additionalProperties, childCat.additionalProperties) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, petType, super.hashCode(), additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChildCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" petType: ").append(toIndentedString(petType)).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 "); + } + +static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("ChildCat", ChildCat.class); + JSON.registerDiscriminator(ChildCat.class, "pet_type", mappings); +} +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ChildCatAllOf.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ChildCatAllOf.java new file mode 100644 index 000000000000..23b63e3e69a0 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ChildCatAllOf.java @@ -0,0 +1,159 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Set; +import java.util.HashSet; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * ChildCatAllOf + */ +@JsonPropertyOrder({ + ChildCatAllOf.JSON_PROPERTY_NAME, + ChildCatAllOf.JSON_PROPERTY_PET_TYPE +}) +@JsonTypeName("ChildCat_allOf") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ChildCatAllOf { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PET_TYPE = "pet_type"; + private String petType = "ChildCat"; + + public ChildCatAllOf() { + } + + public ChildCatAllOf name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + + public static final Set PET_TYPE_VALUES = new HashSet<>(Arrays.asList( + "ChildCat" + )); + + public ChildCatAllOf petType(String petType) { + if (!PET_TYPE_VALUES.contains(petType)) { + throw new IllegalArgumentException(petType + " is invalid. Possible values for petType: " + String.join(", ", PET_TYPE_VALUES)); + } + + this.petType = petType; + return this; + } + + /** + * Get petType + * @return petType + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PET_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPetType() { + return petType; + } + + + @JsonProperty(JSON_PROPERTY_PET_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPetType(String petType) { + if (!PET_TYPE_VALUES.contains(petType)) { + throw new IllegalArgumentException(petType + " is invalid. Possible values for petType: " + String.join(", ", PET_TYPE_VALUES)); + } + + this.petType = petType; + } + + + /** + * Return true if this ChildCat_allOf object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChildCatAllOf childCatAllOf = (ChildCatAllOf) o; + return Objects.equals(this.name, childCatAllOf.name) && + Objects.equals(this.petType, childCatAllOf.petType); + } + + @Override + public int hashCode() { + return Objects.hash(name, petType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChildCatAllOf {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" petType: ").append(toIndentedString(petType)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ClassModel.java new file mode 100644 index 000000000000..d1251c7f6453 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ClassModel.java @@ -0,0 +1,113 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Model for testing model with \"_class\" property + */ +@ApiModel(description = "Model for testing model with \"_class\" property") +@JsonPropertyOrder({ + ClassModel.JSON_PROPERTY_PROPERTY_CLASS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ClassModel { + public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class"; + private String propertyClass; + + public ClassModel() { + } + + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPropertyClass() { + return propertyClass; + } + + + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + /** + * Return true if this ClassModel object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Client.java new file mode 100644 index 000000000000..28fd90dce193 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Client.java @@ -0,0 +1,112 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Client + */ +@JsonPropertyOrder({ + Client.JSON_PROPERTY_CLIENT +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Client { + public static final String JSON_PROPERTY_CLIENT = "client"; + private String client; + + public Client() { + } + + public Client client(String client) { + this.client = client; + return this; + } + + /** + * Get client + * @return client + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CLIENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getClient() { + return client; + } + + + @JsonProperty(JSON_PROPERTY_CLIENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setClient(String client) { + this.client = client; + } + + + /** + * Return true if this Client object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + sb.append(" client: ").append(toIndentedString(client)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java new file mode 100644 index 000000000000..0a5b037ab6e5 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -0,0 +1,189 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.QuadrilateralInterface; +import org.openapitools.client.model.ShapeInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * ComplexQuadrilateral + */ +@JsonPropertyOrder({ + ComplexQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, + ComplexQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ComplexQuadrilateral { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + private String shapeType; + + public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType"; + private String quadrilateralType; + + public ComplexQuadrilateral() { + } + + public ComplexQuadrilateral shapeType(String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public ComplexQuadrilateral quadrilateralType(String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setQuadrilateralType(String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * 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. + */ + @JsonAnySetter + public ComplexQuadrilateral 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this ComplexQuadrilateral object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ComplexQuadrilateral complexQuadrilateral = (ComplexQuadrilateral) o; + return Objects.equals(this.shapeType, complexQuadrilateral.shapeType) && + Objects.equals(this.quadrilateralType, complexQuadrilateral.quadrilateralType)&& + Objects.equals(this.additionalProperties, complexQuadrilateral.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(shapeType, quadrilateralType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ComplexQuadrilateral {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).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 "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DanishPig.java new file mode 100644 index 000000000000..01c761a5d4b5 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DanishPig.java @@ -0,0 +1,112 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * DanishPig + */ +@JsonPropertyOrder({ + DanishPig.JSON_PROPERTY_CLASS_NAME +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DanishPig { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + private String className; + + public DanishPig() { + } + + public DanishPig className(String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(String className) { + this.className = className; + } + + + /** + * Return true if this DanishPig object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DanishPig danishPig = (DanishPig) o; + return Objects.equals(this.className, danishPig.className); + } + + @Override + public int hashCode() { + return Objects.hash(className); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DanishPig {\n"); + sb.append(" className: ").append(toIndentedString(className)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DeprecatedObject.java new file mode 100644 index 000000000000..b0fb094a3d6f --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * DeprecatedObject + * @deprecated + */ +@Deprecated +@JsonPropertyOrder({ + DeprecatedObject.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DeprecatedObject { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public DeprecatedObject() { + } + + public DeprecatedObject name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + + /** + * Return true if this DeprecatedObject object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeprecatedObject deprecatedObject = (DeprecatedObject) o; + return Objects.equals(this.name, deprecatedObject.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeprecatedObject {\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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 000000000000..ee816b578313 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,174 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Animal; +import org.openapitools.client.model.DogAllOf; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Dog + */ +@JsonPropertyOrder({ + Dog.JSON_PROPERTY_BREED +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonIgnoreProperties( + value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the className to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) + +public class Dog extends Animal { + public static final String JSON_PROPERTY_BREED = "breed"; + private String breed; + + public Dog() { + } + + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBreed() { + return breed; + } + + + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBreed(String breed) { + this.breed = breed; + } + + /** + * 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. + */ + @JsonAnySetter + public Dog 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this Dog object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed)&& + Objects.equals(this.additionalProperties, dog.additionalProperties) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode(), additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).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 "); + } + +static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Dog", Dog.class); + JSON.registerDiscriminator(Dog.class, "className", mappings); +} +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DogAllOf.java new file mode 100644 index 000000000000..a3b92e6c6483 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -0,0 +1,113 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * DogAllOf + */ +@JsonPropertyOrder({ + DogAllOf.JSON_PROPERTY_BREED +}) +@JsonTypeName("Dog_allOf") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DogAllOf { + public static final String JSON_PROPERTY_BREED = "breed"; + private String breed; + + public DogAllOf() { + } + + public DogAllOf breed(String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBreed() { + return breed; + } + + + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBreed(String breed) { + this.breed = breed; + } + + + /** + * Return true if this Dog_allOf object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DogAllOf dogAllOf = (DogAllOf) o; + return Objects.equals(this.breed, dogAllOf.breed); + } + + @Override + public int hashCode() { + return Objects.hash(breed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DogAllOf {\n"); + sb.append(" breed: ").append(toIndentedString(breed)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Drawing.java new file mode 100644 index 000000000000..54dc66e511cf --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Drawing.java @@ -0,0 +1,288 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.Fruit; +import org.openapitools.client.model.NullableShape; +import org.openapitools.client.model.Shape; +import org.openapitools.client.model.ShapeOrNull; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Drawing + */ +@JsonPropertyOrder({ + Drawing.JSON_PROPERTY_MAIN_SHAPE, + Drawing.JSON_PROPERTY_SHAPE_OR_NULL, + Drawing.JSON_PROPERTY_NULLABLE_SHAPE, + Drawing.JSON_PROPERTY_SHAPES +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Drawing { + public static final String JSON_PROPERTY_MAIN_SHAPE = "mainShape"; + private Shape mainShape; + + public static final String JSON_PROPERTY_SHAPE_OR_NULL = "shapeOrNull"; + private ShapeOrNull shapeOrNull; + + public static final String JSON_PROPERTY_NULLABLE_SHAPE = "nullableShape"; + private JsonNullable nullableShape = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SHAPES = "shapes"; + private List shapes = null; + + public Drawing() { + } + + public Drawing mainShape(Shape mainShape) { + this.mainShape = mainShape; + return this; + } + + /** + * Get mainShape + * @return mainShape + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAIN_SHAPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Shape getMainShape() { + return mainShape; + } + + + @JsonProperty(JSON_PROPERTY_MAIN_SHAPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMainShape(Shape mainShape) { + this.mainShape = mainShape; + } + + + public Drawing shapeOrNull(ShapeOrNull shapeOrNull) { + this.shapeOrNull = shapeOrNull; + return this; + } + + /** + * Get shapeOrNull + * @return shapeOrNull + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ShapeOrNull getShapeOrNull() { + return shapeOrNull; + } + + + @JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShapeOrNull(ShapeOrNull shapeOrNull) { + this.shapeOrNull = shapeOrNull; + } + + + public Drawing nullableShape(NullableShape nullableShape) { + this.nullableShape = JsonNullable.of(nullableShape); + return this; + } + + /** + * Get nullableShape + * @return nullableShape + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public NullableShape getNullableShape() { + return nullableShape.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_SHAPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNullableShape_JsonNullable() { + return nullableShape; + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_SHAPE) + public void setNullableShape_JsonNullable(JsonNullable nullableShape) { + this.nullableShape = nullableShape; + } + + public void setNullableShape(NullableShape nullableShape) { + this.nullableShape = JsonNullable.of(nullableShape); + } + + + public Drawing shapes(List shapes) { + this.shapes = shapes; + return this; + } + + public Drawing addShapesItem(Shape shapesItem) { + if (this.shapes == null) { + this.shapes = new ArrayList<>(); + } + this.shapes.add(shapesItem); + return this; + } + + /** + * Get shapes + * @return shapes + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SHAPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getShapes() { + return shapes; + } + + + @JsonProperty(JSON_PROPERTY_SHAPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShapes(List shapes) { + this.shapes = shapes; + } + + /** + * 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. + */ + @JsonAnySetter + public Drawing putAdditionalProperty(String key, Fruit value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Fruit getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this Drawing object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Drawing drawing = (Drawing) o; + return Objects.equals(this.mainShape, drawing.mainShape) && + Objects.equals(this.shapeOrNull, drawing.shapeOrNull) && + equalsNullable(this.nullableShape, drawing.nullableShape) && + Objects.equals(this.shapes, drawing.shapes)&& + Objects.equals(this.additionalProperties, drawing.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(mainShape, shapeOrNull, hashCodeNullable(nullableShape), shapes, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Drawing {\n"); + sb.append(" mainShape: ").append(toIndentedString(mainShape)).append("\n"); + sb.append(" shapeOrNull: ").append(toIndentedString(shapeOrNull)).append("\n"); + sb.append(" nullableShape: ").append(toIndentedString(nullableShape)).append("\n"); + sb.append(" shapes: ").append(toIndentedString(shapes)).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 "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumArrays.java new file mode 100644 index 000000000000..881df95c012d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -0,0 +1,224 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * EnumArrays + */ +@JsonPropertyOrder({ + EnumArrays.JSON_PROPERTY_JUST_SYMBOL, + EnumArrays.JSON_PROPERTY_ARRAY_ENUM +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String value) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_JUST_SYMBOL = "just_symbol"; + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String value) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ARRAY_ENUM = "array_enum"; + private List arrayEnum = null; + + public EnumArrays() { + } + + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_JUST_SYMBOL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + + @JsonProperty(JSON_PROPERTY_JUST_SYMBOL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + + public EnumArrays arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return this; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (this.arrayEnum == null) { + this.arrayEnum = new ArrayList<>(); + } + this.arrayEnum.add(arrayEnumItem); + return this; + } + + /** + * Get arrayEnum + * @return arrayEnum + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayEnum() { + return arrayEnum; + } + + + @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + + /** + * Return true if this EnumArrays object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumClass.java new file mode 100644 index 000000000000..973b51cc93e4 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumClass.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String value) { + for (EnumClass b : EnumClass.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumTest.java new file mode 100644 index 000000000000..85b24eb3cff7 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumTest.java @@ -0,0 +1,575 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.OuterEnumDefaultValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.openapitools.client.model.OuterEnumIntegerDefaultValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * EnumTest + */ +@JsonPropertyOrder({ + EnumTest.JSON_PROPERTY_ENUM_STRING, + EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, + EnumTest.JSON_PROPERTY_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_ENUM_INTEGER_ONLY, + EnumTest.JSON_PROPERTY_ENUM_NUMBER, + EnumTest.JSON_PROPERTY_OUTER_ENUM, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE +}) +@JsonTypeName("Enum_Test") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EnumTest { + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringEnum fromValue(String value) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_STRING = "enum_string"; + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String value) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_STRING_REQUIRED = "enum_string_required"; + private EnumStringRequiredEnum enumStringRequired; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(Integer value) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_INTEGER = "enum_integer"; + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumIntegerOnly + */ + public enum EnumIntegerOnlyEnum { + NUMBER_2(2), + + NUMBER_MINUS_2(-2); + + private Integer value; + + EnumIntegerOnlyEnum(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerOnlyEnum fromValue(Integer value) { + for (EnumIntegerOnlyEnum b : EnumIntegerOnlyEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_INTEGER_ONLY = "enum_integer_only"; + private EnumIntegerOnlyEnum enumIntegerOnly; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @JsonValue + public Double getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumNumberEnum fromValue(Double value) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_NUMBER = "enum_number"; + private EnumNumberEnum enumNumber; + + public static final String JSON_PROPERTY_OUTER_ENUM = "outerEnum"; + private JsonNullable outerEnum = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER = "outerEnumInteger"; + private OuterEnumInteger outerEnumInteger; + + public static final String JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE = "outerEnumDefaultValue"; + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE = "outerEnumIntegerDefaultValue"; + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + + public EnumTest() { + } + + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumStringEnum getEnumString() { + return enumString; + } + + + @JsonProperty(JSON_PROPERTY_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + + @JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + public EnumTest enumIntegerOnly(EnumIntegerOnlyEnum enumIntegerOnly) { + this.enumIntegerOnly = enumIntegerOnly; + return this; + } + + /** + * Get enumIntegerOnly + * @return enumIntegerOnly + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER_ONLY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumIntegerOnlyEnum getEnumIntegerOnly() { + return enumIntegerOnly; + } + + + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER_ONLY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumIntegerOnly(EnumIntegerOnlyEnum enumIntegerOnly) { + this.enumIntegerOnly = enumIntegerOnly; + } + + + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + + @JsonProperty(JSON_PROPERTY_ENUM_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = JsonNullable.of(outerEnum); + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public OuterEnum getOuterEnum() { + return outerEnum.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getOuterEnum_JsonNullable() { + return outerEnum; + } + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + public void setOuterEnum_JsonNullable(JsonNullable outerEnum) { + this.outerEnum = outerEnum; + } + + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = JsonNullable.of(outerEnum); + } + + + public EnumTest outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return this; + } + + /** + * Get outerEnumInteger + * @return outerEnumInteger + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + + public EnumTest outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + /** + * Get outerEnumDefaultValue + * @return outerEnumDefaultValue + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + + public EnumTest outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + /** + * Get outerEnumIntegerDefaultValue + * @return outerEnumIntegerDefaultValue + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } + + + /** + * Return true if this Enum_Test object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumIntegerOnly, enumTest.enumIntegerOnly) && + Objects.equals(this.enumNumber, enumTest.enumNumber) && + equalsNullable(this.outerEnum, enumTest.outerEnum) && + Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) && + Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) && + Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumIntegerOnly, enumNumber, hashCodeNullable(outerEnum), outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumIntegerOnly: ").append(toIndentedString(enumIntegerOnly)).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(); + } + + /** + * 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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java new file mode 100644 index 000000000000..217e53a7d871 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -0,0 +1,189 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * EquilateralTriangle + */ +@JsonPropertyOrder({ + EquilateralTriangle.JSON_PROPERTY_SHAPE_TYPE, + EquilateralTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EquilateralTriangle { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + private String shapeType; + + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + private String triangleType; + + public EquilateralTriangle() { + } + + public EquilateralTriangle shapeType(String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public EquilateralTriangle triangleType(String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTriangleType(String triangleType) { + this.triangleType = triangleType; + } + + /** + * 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. + */ + @JsonAnySetter + public EquilateralTriangle 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this EquilateralTriangle object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EquilateralTriangle equilateralTriangle = (EquilateralTriangle) o; + return Objects.equals(this.shapeType, equilateralTriangle.shapeType) && + Objects.equals(this.triangleType, equilateralTriangle.triangleType)&& + Objects.equals(this.additionalProperties, equilateralTriangle.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(shapeType, triangleType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EquilateralTriangle {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" triangleType: ").append(toIndentedString(triangleType)).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 "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..bc732443e15d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,155 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.ModelFile; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * FileSchemaTestClass + */ +@JsonPropertyOrder({ + FileSchemaTestClass.JSON_PROPERTY_FILE, + FileSchemaTestClass.JSON_PROPERTY_FILES +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FileSchemaTestClass { + public static final String JSON_PROPERTY_FILE = "file"; + private ModelFile _file; + + public static final String JSON_PROPERTY_FILES = "files"; + private List files = null; + + public FileSchemaTestClass() { + } + + public FileSchemaTestClass _file(ModelFile _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ModelFile getFile() { + return _file; + } + + + @JsonProperty(JSON_PROPERTY_FILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFile(ModelFile _file) { + this._file = _file; + } + + + public FileSchemaTestClass files(List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(ModelFile filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FILES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getFiles() { + return files; + } + + + @JsonProperty(JSON_PROPERTY_FILES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFiles(List files) { + this.files = files; + } + + + /** + * Return true if this FileSchemaTestClass object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this._file, fileSchemaTestClass._file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(_file, files); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Foo.java new file mode 100644 index 000000000000..1bb98fb7a83f --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Foo.java @@ -0,0 +1,112 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Foo + */ +@JsonPropertyOrder({ + Foo.JSON_PROPERTY_BAR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Foo { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar = "bar"; + + public Foo() { + } + + public Foo bar(String bar) { + this.bar = bar; + return this; + } + + /** + * Get bar + * @return bar + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBar(String bar) { + this.bar = bar; + } + + + /** + * Return true if this Foo object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Foo foo = (Foo) o; + return Objects.equals(this.bar, foo.bar); + } + + @Override + public int hashCode() { + return Objects.hash(bar); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Foo {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FormatTest.java new file mode 100644 index 000000000000..be0be69f52f9 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FormatTest.java @@ -0,0 +1,608 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * FormatTest + */ +@JsonPropertyOrder({ + FormatTest.JSON_PROPERTY_INTEGER, + FormatTest.JSON_PROPERTY_INT32, + FormatTest.JSON_PROPERTY_INT64, + FormatTest.JSON_PROPERTY_NUMBER, + FormatTest.JSON_PROPERTY_FLOAT, + FormatTest.JSON_PROPERTY_DOUBLE, + FormatTest.JSON_PROPERTY_DECIMAL, + FormatTest.JSON_PROPERTY_STRING, + FormatTest.JSON_PROPERTY_BYTE, + FormatTest.JSON_PROPERTY_BINARY, + FormatTest.JSON_PROPERTY_DATE, + FormatTest.JSON_PROPERTY_DATE_TIME, + FormatTest.JSON_PROPERTY_UUID, + FormatTest.JSON_PROPERTY_PASSWORD, + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS, + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER +}) +@JsonTypeName("format_test") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FormatTest { + public static final String JSON_PROPERTY_INTEGER = "integer"; + private Integer integer; + + public static final String JSON_PROPERTY_INT32 = "int32"; + private Integer int32; + + public static final String JSON_PROPERTY_INT64 = "int64"; + private Long int64; + + public static final String JSON_PROPERTY_NUMBER = "number"; + private BigDecimal number; + + public static final String JSON_PROPERTY_FLOAT = "float"; + private Float _float; + + public static final String JSON_PROPERTY_DOUBLE = "double"; + private Double _double; + + public static final String JSON_PROPERTY_DECIMAL = "decimal"; + private BigDecimal decimal; + + public static final String JSON_PROPERTY_STRING = "string"; + private String string; + + public static final String JSON_PROPERTY_BYTE = "byte"; + private byte[] _byte; + + public static final String JSON_PROPERTY_BINARY = "binary"; + private File binary; + + public static final String JSON_PROPERTY_DATE = "date"; + private LocalDate date; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_UUID = "uuid"; + private UUID uuid; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS = "pattern_with_digits"; + private String patternWithDigits; + + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER = "pattern_with_digits_and_delimiter"; + private String patternWithDigitsAndDelimiter; + + public FormatTest() { + } + + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInteger() { + return integer; + } + + + @JsonProperty(JSON_PROPERTY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInteger(Integer integer) { + this.integer = integer; + } + + + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INT32) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInt32() { + return int32; + } + + + @JsonProperty(JSON_PROPERTY_INT32) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInt32(Integer int32) { + this.int32 = int32; + } + + + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INT64) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getInt64() { + return int64; + } + + + @JsonProperty(JSON_PROPERTY_INT64) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInt64(Long int64) { + this.int64 = int64; + } + + + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumber() { + return number; + } + + + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNumber(BigDecimal number) { + this.number = number; + } + + + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FLOAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Float getFloat() { + return _float; + } + + + @JsonProperty(JSON_PROPERTY_FLOAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFloat(Float _float) { + this._float = _float; + } + + + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DOUBLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Double getDouble() { + return _double; + } + + + @JsonProperty(JSON_PROPERTY_DOUBLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDouble(Double _double) { + this._double = _double; + } + + + public FormatTest decimal(BigDecimal decimal) { + this.decimal = decimal; + return this; + } + + /** + * Get decimal + * @return decimal + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DECIMAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getDecimal() { + return decimal; + } + + + @JsonProperty(JSON_PROPERTY_DECIMAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDecimal(BigDecimal decimal) { + this.decimal = decimal; + } + + + public FormatTest string(String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getString() { + return string; + } + + + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setString(String string) { + this.string = string; + } + + + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_BYTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public byte[] getByte() { + return _byte; + } + + + @JsonProperty(JSON_PROPERTY_BYTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + + public FormatTest binary(File binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BINARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public File getBinary() { + return binary; + } + + + @JsonProperty(JSON_PROPERTY_BINARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBinary(File binary) { + this.binary = binary; + } + + + public FormatTest date(LocalDate date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(example = "Sun Feb 02 00:00:00 UTC 2020", required = true, value = "") + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public LocalDate getDate() { + return date; + } + + + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setDate(LocalDate date) { + this.date = date; + } + + + public FormatTest dateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(example = "2007-12-03T10:15:30+01:00", value = "") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public FormatTest uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(example = "72f98069-206d-4f12-9f12-3d1e525a8e84", value = "") + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuid() { + return uuid; + } + + + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + + public FormatTest password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPassword() { + return password; + } + + + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPassword(String password) { + this.password = password; + } + + + public FormatTest patternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + return this; + } + + /** + * A string that is a 10 digit number. Can have leading zeros. + * @return patternWithDigits + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "A string that is a 10 digit number. Can have leading zeros.") + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPatternWithDigits() { + return patternWithDigits; + } + + + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPatternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + } + + + public FormatTest patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } + + /** + * A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + * @return patternWithDigitsAndDelimiter + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; + } + + + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPatternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + } + + + /** + * Return true if this format_test object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + 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) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password) && + 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, decimal, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, patternWithDigits, patternWithDigitsAndDelimiter); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + 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"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Fruit.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Fruit.java new file mode 100644 index 000000000000..adf801074209 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Fruit.java @@ -0,0 +1,253 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + +import com.fasterxml.jackson.core.type.TypeReference; + +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonDeserialize(using = Fruit.FruitDeserializer.class) +@JsonSerialize(using = Fruit.FruitSerializer.class) +public class Fruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Fruit.class.getName()); + + public static class FruitSerializer extends StdSerializer { + public FruitSerializer(Class t) { + super(t); + } + + public FruitSerializer() { + this(null); + } + + @Override + public void serialize(Fruit value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class FruitDeserializer extends StdDeserializer { + public FruitDeserializer() { + this(Fruit.class); + } + + public FruitDeserializer(Class vc) { + super(vc); + } + + @Override + public Fruit deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Apple + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Apple.class.equals(Integer.class) || Apple.class.equals(Long.class) || Apple.class.equals(Float.class) || Apple.class.equals(Double.class) || Apple.class.equals(Boolean.class) || Apple.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Apple.class.equals(Integer.class) || Apple.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Apple.class.equals(Float.class) || Apple.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Apple.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Apple.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Apple.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Apple'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Apple'", e); + } + + // deserialize Banana + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Banana.class.equals(Integer.class) || Banana.class.equals(Long.class) || Banana.class.equals(Float.class) || Banana.class.equals(Double.class) || Banana.class.equals(Boolean.class) || Banana.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Banana.class.equals(Integer.class) || Banana.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Banana.class.equals(Float.class) || Banana.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Banana.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Banana.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Banana.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Banana'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Banana'", e); + } + + if (match == 1) { + Fruit ret = new Fruit(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for Fruit: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Fruit getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Fruit cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public Fruit() { + super("oneOf", Boolean.FALSE); + } + + public Fruit(Apple o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Fruit(Banana o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Apple", new GenericType() { + }); + schemas.put("Banana", new GenericType() { + }); + JSON.registerDescendants(Fruit.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return Fruit.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Apple, Banana + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Apple.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Banana.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } + + /** + * Get the actual instance, which can be the following: + * Apple, Banana + * + * @return The actual instance (Apple, Banana) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Apple`. If the actual instance is not `Apple`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Apple` + * @throws ClassCastException if the instance is not `Apple` + */ + public Apple getApple() throws ClassCastException { + return (Apple)super.getActualInstance(); + } + + /** + * Get the actual instance of `Banana`. If the actual instance is not `Banana`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Banana` + * @throws ClassCastException if the instance is not `Banana` + */ + public Banana getBanana() throws ClassCastException { + return (Banana)super.getActualInstance(); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FruitReq.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FruitReq.java new file mode 100644 index 000000000000..aab46f52d759 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FruitReq.java @@ -0,0 +1,260 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + +import com.fasterxml.jackson.core.type.TypeReference; + +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonDeserialize(using = FruitReq.FruitReqDeserializer.class) +@JsonSerialize(using = FruitReq.FruitReqSerializer.class) +public class FruitReq extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FruitReq.class.getName()); + + public static class FruitReqSerializer extends StdSerializer { + public FruitReqSerializer(Class t) { + super(t); + } + + public FruitReqSerializer() { + this(null); + } + + @Override + public void serialize(FruitReq value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class FruitReqDeserializer extends StdDeserializer { + public FruitReqDeserializer() { + this(FruitReq.class); + } + + public FruitReqDeserializer(Class vc) { + super(vc); + } + + @Override + public FruitReq deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize AppleReq + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AppleReq.class.equals(Integer.class) || AppleReq.class.equals(Long.class) || AppleReq.class.equals(Float.class) || AppleReq.class.equals(Double.class) || AppleReq.class.equals(Boolean.class) || AppleReq.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((AppleReq.class.equals(Integer.class) || AppleReq.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((AppleReq.class.equals(Float.class) || AppleReq.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (AppleReq.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (AppleReq.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(AppleReq.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'AppleReq'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AppleReq'", e); + } + + // deserialize BananaReq + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (BananaReq.class.equals(Integer.class) || BananaReq.class.equals(Long.class) || BananaReq.class.equals(Float.class) || BananaReq.class.equals(Double.class) || BananaReq.class.equals(Boolean.class) || BananaReq.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((BananaReq.class.equals(Integer.class) || BananaReq.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((BananaReq.class.equals(Float.class) || BananaReq.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (BananaReq.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (BananaReq.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(BananaReq.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'BananaReq'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'BananaReq'", e); + } + + if (match == 1) { + FruitReq ret = new FruitReq(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for FruitReq: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public FruitReq getNullValue(DeserializationContext ctxt) throws JsonMappingException { + return null; + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public FruitReq() { + super("oneOf", Boolean.TRUE); + } + + public FruitReq(AppleReq o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + public FruitReq(BananaReq o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + static { + schemas.put("AppleReq", new GenericType() { + }); + schemas.put("BananaReq", new GenericType() { + }); + JSON.registerDescendants(FruitReq.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return FruitReq.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * AppleReq, BananaReq + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(AppleReq.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(BananaReq.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be AppleReq, BananaReq"); + } + + /** + * Get the actual instance, which can be the following: + * AppleReq, BananaReq + * + * @return The actual instance (AppleReq, BananaReq) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AppleReq`. If the actual instance is not `AppleReq`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `AppleReq` + * @throws ClassCastException if the instance is not `AppleReq` + */ + public AppleReq getAppleReq() throws ClassCastException { + return (AppleReq)super.getActualInstance(); + } + + /** + * Get the actual instance of `BananaReq`. If the actual instance is not `BananaReq`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BananaReq` + * @throws ClassCastException if the instance is not `BananaReq` + */ + public BananaReq getBananaReq() throws ClassCastException { + return (BananaReq)super.getActualInstance(); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GmFruit.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GmFruit.java new file mode 100644 index 000000000000..c7b1861369c3 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GmFruit.java @@ -0,0 +1,213 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonDeserialize(using=GmFruit.GmFruitDeserializer.class) +@JsonSerialize(using = GmFruit.GmFruitSerializer.class) +public class GmFruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GmFruit.class.getName()); + + public static class GmFruitSerializer extends StdSerializer { + public GmFruitSerializer(Class t) { + super(t); + } + + public GmFruitSerializer() { + this(null); + } + + @Override + public void serialize(GmFruit value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GmFruitDeserializer extends StdDeserializer { + public GmFruitDeserializer() { + this(GmFruit.class); + } + + public GmFruitDeserializer(Class vc) { + super(vc); + } + + @Override + public GmFruit deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + Object deserialized = null; + // deserialize Apple + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Apple.class); + GmFruit ret = new GmFruit(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'GmFruit'", e); + } + + // deserialize Banana + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Banana.class); + GmFruit ret = new GmFruit(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'GmFruit'", e); + } + + throw new IOException(String.format("Failed deserialization for GmFruit: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public GmFruit getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "GmFruit cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map schemas = new HashMap(); + + public GmFruit() { + super("anyOf", Boolean.FALSE); + } + + public GmFruit(Apple o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public GmFruit(Banana o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Apple", new GenericType() { + }); + schemas.put("Banana", new GenericType() { + }); + JSON.registerDescendants(GmFruit.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GmFruit.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Apple, Banana + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Apple.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Banana.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } + + /** + * Get the actual instance, which can be the following: + * Apple, Banana + * + * @return The actual instance (Apple, Banana) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Apple`. If the actual instance is not `Apple`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Apple` + * @throws ClassCastException if the instance is not `Apple` + */ + public Apple getApple() throws ClassCastException { + return (Apple)super.getActualInstance(); + } + + /** + * Get the actual instance of `Banana`. If the actual instance is not `Banana`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Banana` + * @throws ClassCastException if the instance is not `Banana` + */ + public Banana getBanana() throws ClassCastException { + return (Banana)super.getActualInstance(); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java new file mode 100644 index 000000000000..291a97faf0ce --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -0,0 +1,135 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ChildCat; +import org.openapitools.client.model.ParentPet; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * GrandparentAnimal + */ +@JsonPropertyOrder({ + GrandparentAnimal.JSON_PROPERTY_PET_TYPE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonIgnoreProperties( + value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the pet_type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ChildCat.class, name = "ChildCat"), + @JsonSubTypes.Type(value = ParentPet.class, name = "ParentPet"), +}) + +public class GrandparentAnimal { + public static final String JSON_PROPERTY_PET_TYPE = "pet_type"; + private String petType; + + public GrandparentAnimal() { + } + + public GrandparentAnimal petType(String petType) { + this.petType = petType; + return this; + } + + /** + * Get petType + * @return petType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PET_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPetType() { + return petType; + } + + + @JsonProperty(JSON_PROPERTY_PET_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPetType(String petType) { + this.petType = petType; + } + + + /** + * Return true if this GrandparentAnimal object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GrandparentAnimal grandparentAnimal = (GrandparentAnimal) o; + return Objects.equals(this.petType, grandparentAnimal.petType); + } + + @Override + public int hashCode() { + return Objects.hash(petType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GrandparentAnimal {\n"); + sb.append(" petType: ").append(toIndentedString(petType)).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 "); + } + +static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("ChildCat", ChildCat.class); + mappings.put("ParentPet", ParentPet.class); + mappings.put("GrandparentAnimal", GrandparentAnimal.class); + JSON.registerDiscriminator(GrandparentAnimal.class, "pet_type", mappings); +} +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..b7170439fcfc --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -0,0 +1,135 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * HasOnlyReadOnly + */ +@JsonPropertyOrder({ + HasOnlyReadOnly.JSON_PROPERTY_BAR, + HasOnlyReadOnly.JSON_PROPERTY_FOO +}) +@JsonTypeName("hasOnlyReadOnly") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class HasOnlyReadOnly { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar; + + public static final String JSON_PROPERTY_FOO = "foo"; + private String foo; + + public HasOnlyReadOnly() { + } + + @JsonCreator + public HasOnlyReadOnly( + @JsonProperty(JSON_PROPERTY_BAR) String bar, + @JsonProperty(JSON_PROPERTY_FOO) String foo + ) { + this(); + this.bar = bar; + this.foo = foo; + } + + /** + * Get bar + * @return bar + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + + /** + * Get foo + * @return foo + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FOO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getFoo() { + return foo; + } + + + + + /** + * Return true if this hasOnlyReadOnly object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HealthCheckResult.java new file mode 100644 index 000000000000..6016e3fedb66 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -0,0 +1,136 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + */ +@ApiModel(description = "Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.") +@JsonPropertyOrder({ + HealthCheckResult.JSON_PROPERTY_NULLABLE_MESSAGE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class HealthCheckResult { + public static final String JSON_PROPERTY_NULLABLE_MESSAGE = "NullableMessage"; + private JsonNullable nullableMessage = JsonNullable.undefined(); + + public HealthCheckResult() { + } + + public HealthCheckResult nullableMessage(String nullableMessage) { + this.nullableMessage = JsonNullable.of(nullableMessage); + return this; + } + + /** + * Get nullableMessage + * @return nullableMessage + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public String getNullableMessage() { + return nullableMessage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNullableMessage_JsonNullable() { + return nullableMessage; + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) + public void setNullableMessage_JsonNullable(JsonNullable nullableMessage) { + this.nullableMessage = nullableMessage; + } + + public void setNullableMessage(String nullableMessage) { + this.nullableMessage = JsonNullable.of(nullableMessage); + } + + + /** + * Return true if this HealthCheckResult object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HealthCheckResult healthCheckResult = (HealthCheckResult) o; + return equalsNullable(this.nullableMessage, healthCheckResult.nullableMessage); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(hashCodeNullable(nullableMessage)); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @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 "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject.java new file mode 100644 index 000000000000..3ee32239de90 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject.java @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * InlineObject + */ +@JsonPropertyOrder({ + InlineObject.JSON_PROPERTY_NAME, + InlineObject.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InlineObject { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + + public InlineObject name(String name) { + this.name = name; + return this; + } + + /** + * Updated name of the pet + * @return name + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "Updated name of the pet") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public InlineObject status(String status) { + this.status = status; + return this; + } + + /** + * Updated status of the pet + * @return status + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "Updated status of the pet") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + /** + * Return true if this inline_object object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject inlineObject = (InlineObject) o; + return Objects.equals(this.name, inlineObject.name) && + Objects.equals(this.status, inlineObject.status); + } + + @Override + public int hashCode() { + return Objects.hash(name, status); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject {\n"); + sb.append(" name: ").append(toIndentedString(name)).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 String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject1.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject1.java new file mode 100644 index 000000000000..8a96745d564d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject1.java @@ -0,0 +1,140 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * InlineObject1 + */ +@JsonPropertyOrder({ + InlineObject1.JSON_PROPERTY_ADDITIONAL_METADATA, + InlineObject1.JSON_PROPERTY_FILE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InlineObject1 { + public static final String JSON_PROPERTY_ADDITIONAL_METADATA = "additionalMetadata"; + private String additionalMetadata; + + public static final String JSON_PROPERTY_FILE = "file"; + private File file; + + + public InlineObject1 additionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + return this; + } + + /** + * Additional data to pass to server + * @return additionalMetadata + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "Additional data to pass to server") + @JsonProperty(JSON_PROPERTY_ADDITIONAL_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAdditionalMetadata() { + return additionalMetadata; + } + + + public void setAdditionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + } + + + public InlineObject1 file(File file) { + this.file = file; + return this; + } + + /** + * file to upload + * @return file + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "file to upload") + @JsonProperty(JSON_PROPERTY_FILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public File getFile() { + return file; + } + + + public void setFile(File file) { + this.file = file; + } + + + /** + * Return true if this inline_object_1 object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject1 inlineObject1 = (InlineObject1) o; + return Objects.equals(this.additionalMetadata, inlineObject1.additionalMetadata) && + Objects.equals(this.file, inlineObject1.file); + } + + @Override + public int hashCode() { + return Objects.hash(additionalMetadata, file); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject1 {\n"); + sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n"); + sb.append(" file: ").append(toIndentedString(file)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject2.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject2.java new file mode 100644 index 000000000000..89e0390aba41 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject2.java @@ -0,0 +1,221 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * InlineObject2 + */ +@JsonPropertyOrder({ + InlineObject2.JSON_PROPERTY_ENUM_FORM_STRING_ARRAY, + InlineObject2.JSON_PROPERTY_ENUM_FORM_STRING +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InlineObject2 { + /** + * Gets or Sets enumFormStringArray + */ + public enum EnumFormStringArrayEnum { + GREATER_THAN(">"), + + DOLLAR("$"); + + private String value; + + EnumFormStringArrayEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumFormStringArrayEnum fromValue(String value) { + for (EnumFormStringArrayEnum b : EnumFormStringArrayEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_FORM_STRING_ARRAY = "enum_form_string_array"; + private List enumFormStringArray = null; + + /** + * Form parameter enum test (string) + */ + public enum EnumFormStringEnum { + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumFormStringEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumFormStringEnum fromValue(String value) { + for (EnumFormStringEnum b : EnumFormStringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_FORM_STRING = "enum_form_string"; + private EnumFormStringEnum enumFormString = EnumFormStringEnum._EFG; + + + public InlineObject2 enumFormStringArray(List enumFormStringArray) { + this.enumFormStringArray = enumFormStringArray; + return this; + } + + public InlineObject2 addEnumFormStringArrayItem(EnumFormStringArrayEnum enumFormStringArrayItem) { + if (this.enumFormStringArray == null) { + this.enumFormStringArray = new ArrayList<>(); + } + this.enumFormStringArray.add(enumFormStringArrayItem); + return this; + } + + /** + * Form parameter enum test (string array) + * @return enumFormStringArray + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "Form parameter enum test (string array)") + @JsonProperty(JSON_PROPERTY_ENUM_FORM_STRING_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getEnumFormStringArray() { + return enumFormStringArray; + } + + + public void setEnumFormStringArray(List enumFormStringArray) { + this.enumFormStringArray = enumFormStringArray; + } + + + public InlineObject2 enumFormString(EnumFormStringEnum enumFormString) { + this.enumFormString = enumFormString; + return this; + } + + /** + * Form parameter enum test (string) + * @return enumFormString + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "Form parameter enum test (string)") + @JsonProperty(JSON_PROPERTY_ENUM_FORM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumFormStringEnum getEnumFormString() { + return enumFormString; + } + + + public void setEnumFormString(EnumFormStringEnum enumFormString) { + this.enumFormString = enumFormString; + } + + + /** + * Return true if this inline_object_2 object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject2 inlineObject2 = (InlineObject2) o; + return Objects.equals(this.enumFormStringArray, inlineObject2.enumFormStringArray) && + Objects.equals(this.enumFormString, inlineObject2.enumFormString); + } + + @Override + public int hashCode() { + return Objects.hash(enumFormStringArray, enumFormString); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject2 {\n"); + sb.append(" enumFormStringArray: ").append(toIndentedString(enumFormStringArray)).append("\n"); + sb.append(" enumFormString: ").append(toIndentedString(enumFormString)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject3.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject3.java new file mode 100644 index 000000000000..9c260e432f47 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject3.java @@ -0,0 +1,508 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * InlineObject3 + */ +@JsonPropertyOrder({ + InlineObject3.JSON_PROPERTY_INTEGER, + InlineObject3.JSON_PROPERTY_INT32, + InlineObject3.JSON_PROPERTY_INT64, + InlineObject3.JSON_PROPERTY_NUMBER, + InlineObject3.JSON_PROPERTY_FLOAT, + InlineObject3.JSON_PROPERTY_DOUBLE, + InlineObject3.JSON_PROPERTY_STRING, + InlineObject3.JSON_PROPERTY_PATTERN_WITHOUT_DELIMITER, + InlineObject3.JSON_PROPERTY_BYTE, + InlineObject3.JSON_PROPERTY_BINARY, + InlineObject3.JSON_PROPERTY_DATE, + InlineObject3.JSON_PROPERTY_DATE_TIME, + InlineObject3.JSON_PROPERTY_PASSWORD, + InlineObject3.JSON_PROPERTY_CALLBACK +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InlineObject3 { + public static final String JSON_PROPERTY_INTEGER = "integer"; + private Integer integer; + + public static final String JSON_PROPERTY_INT32 = "int32"; + private Integer int32; + + public static final String JSON_PROPERTY_INT64 = "int64"; + private Long int64; + + public static final String JSON_PROPERTY_NUMBER = "number"; + private BigDecimal number; + + public static final String JSON_PROPERTY_FLOAT = "float"; + private Float _float; + + public static final String JSON_PROPERTY_DOUBLE = "double"; + private Double _double; + + public static final String JSON_PROPERTY_STRING = "string"; + private String string; + + public static final String JSON_PROPERTY_PATTERN_WITHOUT_DELIMITER = "pattern_without_delimiter"; + private String patternWithoutDelimiter; + + public static final String JSON_PROPERTY_BYTE = "byte"; + private byte[] _byte; + + public static final String JSON_PROPERTY_BINARY = "binary"; + private File binary; + + public static final String JSON_PROPERTY_DATE = "date"; + private LocalDate date; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private OffsetDateTime dateTime = OffsetDateTime.parse("2010-02-01T09:20:10.111110Z[UTC]", java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME.withZone(java.time.ZoneId.systemDefault())); + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_CALLBACK = "callback"; + private String callback; + + + public InlineObject3 integer(Integer integer) { + this.integer = integer; + return this; + } + + /** + * None + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInteger() { + return integer; + } + + + public void setInteger(Integer integer) { + this.integer = integer; + } + + + public InlineObject3 int32(Integer int32) { + this.int32 = int32; + return this; + } + + /** + * None + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_INT32) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInt32() { + return int32; + } + + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + + public InlineObject3 int64(Long int64) { + this.int64 = int64; + return this; + } + + /** + * None + * @return int64 + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_INT64) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getInt64() { + return int64; + } + + + public void setInt64(Long int64) { + this.int64 = int64; + } + + + public InlineObject3 number(BigDecimal number) { + this.number = number; + return this; + } + + /** + * None + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumber() { + return number; + } + + + public void setNumber(BigDecimal number) { + this.number = number; + } + + + public InlineObject3 _float(Float _float) { + this._float = _float; + return this; + } + + /** + * None + * maximum: 987.6 + * @return _float + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_FLOAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Float getFloat() { + return _float; + } + + + public void setFloat(Float _float) { + this._float = _float; + } + + + public InlineObject3 _double(Double _double) { + this._double = _double; + return this; + } + + /** + * None + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_DOUBLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Double getDouble() { + return _double; + } + + + public void setDouble(Double _double) { + this._double = _double; + } + + + public InlineObject3 string(String string) { + this.string = string; + return this; + } + + /** + * None + * @return string + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getString() { + return string; + } + + + public void setString(String string) { + this.string = string; + } + + + public InlineObject3 patternWithoutDelimiter(String patternWithoutDelimiter) { + this.patternWithoutDelimiter = patternWithoutDelimiter; + return this; + } + + /** + * None + * @return patternWithoutDelimiter + **/ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_PATTERN_WITHOUT_DELIMITER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPatternWithoutDelimiter() { + return patternWithoutDelimiter; + } + + + public void setPatternWithoutDelimiter(String patternWithoutDelimiter) { + this.patternWithoutDelimiter = patternWithoutDelimiter; + } + + + public InlineObject3 _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * None + * @return _byte + **/ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_BYTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public byte[] getByte() { + return _byte; + } + + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + + public InlineObject3 binary(File binary) { + this.binary = binary; + return this; + } + + /** + * None + * @return binary + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_BINARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public File getBinary() { + return binary; + } + + + public void setBinary(File binary) { + this.binary = binary; + } + + + public InlineObject3 date(LocalDate date) { + this.date = date; + return this; + } + + /** + * None + * @return date + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public LocalDate getDate() { + return date; + } + + + public void setDate(LocalDate date) { + this.date = date; + } + + + public InlineObject3 dateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * None + * @return dateTime + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(example = "2020-02-02T20:20:20.222220Z", value = "None") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public InlineObject3 password(String password) { + this.password = password; + return this; + } + + /** + * None + * @return password + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public InlineObject3 callback(String callback) { + this.callback = callback; + return this; + } + + /** + * None + * @return callback + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_CALLBACK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCallback() { + return callback; + } + + + public void setCallback(String callback) { + this.callback = callback; + } + + + /** + * Return true if this inline_object_3 object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject3 inlineObject3 = (InlineObject3) o; + return Objects.equals(this.integer, inlineObject3.integer) && + Objects.equals(this.int32, inlineObject3.int32) && + Objects.equals(this.int64, inlineObject3.int64) && + Objects.equals(this.number, inlineObject3.number) && + Objects.equals(this._float, inlineObject3._float) && + Objects.equals(this._double, inlineObject3._double) && + Objects.equals(this.string, inlineObject3.string) && + Objects.equals(this.patternWithoutDelimiter, inlineObject3.patternWithoutDelimiter) && + Arrays.equals(this._byte, inlineObject3._byte) && + Objects.equals(this.binary, inlineObject3.binary) && + Objects.equals(this.date, inlineObject3.date) && + Objects.equals(this.dateTime, inlineObject3.dateTime) && + Objects.equals(this.password, inlineObject3.password) && + Objects.equals(this.callback, inlineObject3.callback); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, patternWithoutDelimiter, Arrays.hashCode(_byte), binary, date, dateTime, password, callback); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject3 {\n"); + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + 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(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" patternWithoutDelimiter: ").append(toIndentedString(patternWithoutDelimiter)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" callback: ").append(toIndentedString(callback)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject4.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject4.java new file mode 100644 index 000000000000..d0d8d4ca1886 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject4.java @@ -0,0 +1,137 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * InlineObject4 + */ +@JsonPropertyOrder({ + InlineObject4.JSON_PROPERTY_PARAM, + InlineObject4.JSON_PROPERTY_PARAM2 +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InlineObject4 { + public static final String JSON_PROPERTY_PARAM = "param"; + private String param; + + public static final String JSON_PROPERTY_PARAM2 = "param2"; + private String param2; + + + public InlineObject4 param(String param) { + this.param = param; + return this; + } + + /** + * field1 + * @return param + **/ + @ApiModelProperty(required = true, value = "field1") + @JsonProperty(JSON_PROPERTY_PARAM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getParam() { + return param; + } + + + public void setParam(String param) { + this.param = param; + } + + + public InlineObject4 param2(String param2) { + this.param2 = param2; + return this; + } + + /** + * field2 + * @return param2 + **/ + @ApiModelProperty(required = true, value = "field2") + @JsonProperty(JSON_PROPERTY_PARAM2) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getParam2() { + return param2; + } + + + public void setParam2(String param2) { + this.param2 = param2; + } + + + /** + * Return true if this inline_object_4 object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject4 inlineObject4 = (InlineObject4) o; + return Objects.equals(this.param, inlineObject4.param) && + Objects.equals(this.param2, inlineObject4.param2); + } + + @Override + public int hashCode() { + return Objects.hash(param, param2); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject4 {\n"); + sb.append(" param: ").append(toIndentedString(param)).append("\n"); + sb.append(" param2: ").append(toIndentedString(param2)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject5.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject5.java new file mode 100644 index 000000000000..2fb32ee5f855 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineObject5.java @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * InlineObject5 + */ +@JsonPropertyOrder({ + InlineObject5.JSON_PROPERTY_ADDITIONAL_METADATA, + InlineObject5.JSON_PROPERTY_REQUIRED_FILE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InlineObject5 { + public static final String JSON_PROPERTY_ADDITIONAL_METADATA = "additionalMetadata"; + private String additionalMetadata; + + public static final String JSON_PROPERTY_REQUIRED_FILE = "requiredFile"; + private File requiredFile; + + + public InlineObject5 additionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + return this; + } + + /** + * Additional data to pass to server + * @return additionalMetadata + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "Additional data to pass to server") + @JsonProperty(JSON_PROPERTY_ADDITIONAL_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAdditionalMetadata() { + return additionalMetadata; + } + + + public void setAdditionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + } + + + public InlineObject5 requiredFile(File requiredFile) { + this.requiredFile = requiredFile; + return this; + } + + /** + * file to upload + * @return requiredFile + **/ + @ApiModelProperty(required = true, value = "file to upload") + @JsonProperty(JSON_PROPERTY_REQUIRED_FILE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public File getRequiredFile() { + return requiredFile; + } + + + public void setRequiredFile(File requiredFile) { + this.requiredFile = requiredFile; + } + + + /** + * Return true if this inline_object_5 object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject5 inlineObject5 = (InlineObject5) o; + return Objects.equals(this.additionalMetadata, inlineObject5.additionalMetadata) && + Objects.equals(this.requiredFile, inlineObject5.requiredFile); + } + + @Override + public int hashCode() { + return Objects.hash(additionalMetadata, requiredFile); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject5 {\n"); + sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n"); + sb.append(" requiredFile: ").append(toIndentedString(requiredFile)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineResponseDefault.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineResponseDefault.java new file mode 100644 index 000000000000..fd69604e8f74 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/InlineResponseDefault.java @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Foo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * InlineResponseDefault + */ +@JsonPropertyOrder({ + InlineResponseDefault.JSON_PROPERTY_STRING +}) +@JsonTypeName("inline_response_default") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InlineResponseDefault { + public static final String JSON_PROPERTY_STRING = "string"; + private Foo string; + + public InlineResponseDefault() { + } + + public InlineResponseDefault string(Foo string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Foo getString() { + return string; + } + + + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setString(Foo string) { + this.string = string; + } + + + /** + * Return true if this inline_response_default object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineResponseDefault inlineResponseDefault = (InlineResponseDefault) o; + return Objects.equals(this.string, inlineResponseDefault.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineResponseDefault {\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 "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java new file mode 100644 index 000000000000..19e71a3b53c1 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -0,0 +1,146 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * IsoscelesTriangle + */ +@JsonPropertyOrder({ + IsoscelesTriangle.JSON_PROPERTY_SHAPE_TYPE, + IsoscelesTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IsoscelesTriangle { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + private String shapeType; + + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + private String triangleType; + + public IsoscelesTriangle() { + } + + public IsoscelesTriangle shapeType(String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public IsoscelesTriangle triangleType(String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTriangleType(String triangleType) { + this.triangleType = triangleType; + } + + + /** + * Return true if this IsoscelesTriangle object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IsoscelesTriangle isoscelesTriangle = (IsoscelesTriangle) o; + return Objects.equals(this.shapeType, isoscelesTriangle.shapeType) && + Objects.equals(this.triangleType, isoscelesTriangle.triangleType); + } + + @Override + public int hashCode() { + return Objects.hash(shapeType, triangleType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IsoscelesTriangle {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" triangleType: ").append(toIndentedString(triangleType)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Mammal.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Mammal.java new file mode 100644 index 000000000000..b30511645bdc --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Mammal.java @@ -0,0 +1,385 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + +import com.fasterxml.jackson.core.type.TypeReference; + +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonDeserialize(using = Mammal.MammalDeserializer.class) +@JsonSerialize(using = Mammal.MammalSerializer.class) +public class Mammal extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Mammal.class.getName()); + + public static class MammalSerializer extends StdSerializer { + public MammalSerializer(Class t) { + super(t); + } + + public MammalSerializer() { + this(null); + } + + @Override + public void serialize(Mammal value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class MammalDeserializer extends StdDeserializer { + public MammalDeserializer() { + this(Mammal.class); + } + + public MammalDeserializer(Class vc) { + super(vc); + } + + @Override + public Mammal deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Mammal newMammal = new Mammal(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("className"); + switch (discriminatorValue) { + case "Pig": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Pig.class); + newMammal.setActualInstance(deserialized); + return newMammal; + case "whale": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Whale.class); + newMammal.setActualInstance(deserialized); + return newMammal; + case "zebra": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Zebra.class); + newMammal.setActualInstance(deserialized); + return newMammal; + default: + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for Mammal. Possible values: Pig whale zebra", discriminatorValue)); + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Pig + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Pig.class.equals(Integer.class) || Pig.class.equals(Long.class) || Pig.class.equals(Float.class) || Pig.class.equals(Double.class) || Pig.class.equals(Boolean.class) || Pig.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Pig.class.equals(Integer.class) || Pig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Pig.class.equals(Float.class) || Pig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Pig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Pig.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Pig.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Pig'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Pig'", e); + } + + // deserialize Whale + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Whale.class.equals(Integer.class) || Whale.class.equals(Long.class) || Whale.class.equals(Float.class) || Whale.class.equals(Double.class) || Whale.class.equals(Boolean.class) || Whale.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Whale.class.equals(Integer.class) || Whale.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Whale.class.equals(Float.class) || Whale.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Whale.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Whale.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Whale.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Whale'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Whale'", e); + } + + // deserialize Zebra + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Zebra.class.equals(Integer.class) || Zebra.class.equals(Long.class) || Zebra.class.equals(Float.class) || Zebra.class.equals(Double.class) || Zebra.class.equals(Boolean.class) || Zebra.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Zebra.class.equals(Integer.class) || Zebra.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Zebra.class.equals(Float.class) || Zebra.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Zebra.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Zebra.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Zebra.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Zebra'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Zebra'", e); + } + + if (match == 1) { + Mammal ret = new Mammal(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for Mammal: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Mammal getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Mammal cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public Mammal() { + super("oneOf", Boolean.FALSE); + } + /** + * 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. + */ + @JsonAnySetter + public Mammal 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this mammal object is equal to o. + */ + @Override + public boolean equals(Object o) { + return super.equals(o) && Objects.equals(this.additionalProperties, ((Mammal)o).additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); + } + public Mammal(Pig o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Mammal(Whale o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Mammal(Zebra o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Pig", new GenericType() { + }); + schemas.put("Whale", new GenericType() { + }); + schemas.put("Zebra", new GenericType() { + }); + JSON.registerDescendants(Mammal.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Pig", Pig.class); + mappings.put("whale", Whale.class); + mappings.put("zebra", Zebra.class); + mappings.put("mammal", Mammal.class); + JSON.registerDiscriminator(Mammal.class, "className", mappings); + } + + @Override + public Map getSchemas() { + return Mammal.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Pig, Whale, Zebra + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Pig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Whale.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Zebra.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Pig, Whale, Zebra"); + } + + /** + * Get the actual instance, which can be the following: + * Pig, Whale, Zebra + * + * @return The actual instance (Pig, Whale, Zebra) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Pig`. If the actual instance is not `Pig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Pig` + * @throws ClassCastException if the instance is not `Pig` + */ + public Pig getPig() throws ClassCastException { + return (Pig)super.getActualInstance(); + } + + /** + * Get the actual instance of `Whale`. If the actual instance is not `Whale`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Whale` + * @throws ClassCastException if the instance is not `Whale` + */ + public Whale getWhale() throws ClassCastException { + return (Whale)super.getActualInstance(); + } + + /** + * Get the actual instance of `Zebra`. If the actual instance is not `Zebra`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Zebra` + * @throws ClassCastException if the instance is not `Zebra` + */ + public Zebra getZebra() throws ClassCastException { + return (Zebra)super.getActualInstance(); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MapTest.java new file mode 100644 index 000000000000..e25415b8f29d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,278 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * MapTest + */ +@JsonPropertyOrder({ + MapTest.JSON_PROPERTY_MAP_MAP_OF_STRING, + MapTest.JSON_PROPERTY_MAP_OF_ENUM_STRING, + MapTest.JSON_PROPERTY_DIRECT_MAP, + MapTest.JSON_PROPERTY_INDIRECT_MAP +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class MapTest { + public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string"; + private Map> mapMapOfString = null; + + /** + * Gets or Sets inner + */ + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static InnerEnum fromValue(String value) { + for (InnerEnum b : InnerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_MAP_OF_ENUM_STRING = "map_of_enum_string"; + private Map mapOfEnumString = null; + + public static final String JSON_PROPERTY_DIRECT_MAP = "direct_map"; + private Map directMap = null; + + public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map"; + private Map indirectMap = null; + + public MapTest() { + } + + public MapTest mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return this; + } + + public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { + if (this.mapMapOfString == null) { + this.mapMapOfString = new HashMap<>(); + } + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + /** + * Get mapMapOfString + * @return mapMapOfString + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map> getMapMapOfString() { + return mapMapOfString; + } + + + @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + + public MapTest mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return this; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + if (this.mapOfEnumString == null) { + this.mapOfEnumString = new HashMap<>(); + } + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + /** + * Get mapOfEnumString + * @return mapOfEnumString + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + + @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + + public MapTest directMap(Map directMap) { + this.directMap = directMap; + return this; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap<>(); + } + this.directMap.put(key, directMapItem); + return this; + } + + /** + * Get directMap + * @return directMap + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getDirectMap() { + return directMap; + } + + + @JsonProperty(JSON_PROPERTY_DIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDirectMap(Map directMap) { + this.directMap = directMap; + } + + + public MapTest indirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + return this; + } + + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + + /** + * Get indirectMap + * @return indirectMap + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getIndirectMap() { + return indirectMap; + } + + + @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIndirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + } + + + /** + * Return true if this MapTest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..cb3bf60e59ed --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,190 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +@JsonPropertyOrder({ + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_MAP +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class MixedPropertiesAndAdditionalPropertiesClass { + public static final String JSON_PROPERTY_UUID = "uuid"; + private UUID uuid; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_MAP = "map"; + private Map map = null; + + public MixedPropertiesAndAdditionalPropertiesClass() { + } + + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuid() { + return uuid; + } + + + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + if (this.map == null) { + this.map = new HashMap<>(); + } + this.map.put(key, mapItem); + return this; + } + + /** + * Get map + * @return map + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMap() { + return map; + } + + + @JsonProperty(JSON_PROPERTY_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMap(Map map) { + this.map = map; + } + + + /** + * Return true if this MixedPropertiesAndAdditionalPropertiesClass object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Model200Response.java new file mode 100644 index 000000000000..05cc6292c033 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Model200Response.java @@ -0,0 +1,146 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Model for testing model name starting with number + */ +@ApiModel(description = "Model for testing model name starting with number") +@JsonPropertyOrder({ + Model200Response.JSON_PROPERTY_NAME, + Model200Response.JSON_PROPERTY_PROPERTY_CLASS +}) +@JsonTypeName("200_response") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Model200Response { + public static final String JSON_PROPERTY_NAME = "name"; + private Integer name; + + public static final String JSON_PROPERTY_PROPERTY_CLASS = "class"; + private String propertyClass; + + public Model200Response() { + } + + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(Integer name) { + this.name = name; + } + + + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPropertyClass() { + return propertyClass; + } + + + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + /** + * Return true if this 200_response object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..be2abb32dd18 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,177 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * ModelApiResponse + */ +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) +@JsonTypeName("ApiResponse") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +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; + + public ModelApiResponse() { + } + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getCode() { + return code; + } + + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(Integer code) { + this.code = code; + } + + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(String type) { + this.type = type; + } + + + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMessage() { + return message; + } + + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(String message) { + this.message = message; + } + + + /** + * Return true if this ApiResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @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 String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelFile.java new file mode 100644 index 000000000000..e2c262f9e219 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelFile.java @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Must be named `File` for test. + */ +@ApiModel(description = "Must be named `File` for test.") +@JsonPropertyOrder({ + ModelFile.JSON_PROPERTY_SOURCE_U_R_I +}) +@JsonTypeName("File") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ModelFile { + public static final String JSON_PROPERTY_SOURCE_U_R_I = "sourceURI"; + private String sourceURI; + + public ModelFile() { + } + + public ModelFile sourceURI(String sourceURI) { + this.sourceURI = sourceURI; + return this; + } + + /** + * Test capitalization + * @return sourceURI + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "Test capitalization") + @JsonProperty(JSON_PROPERTY_SOURCE_U_R_I) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSourceURI() { + return sourceURI; + } + + + @JsonProperty(JSON_PROPERTY_SOURCE_U_R_I) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSourceURI(String sourceURI) { + this.sourceURI = sourceURI; + } + + + /** + * Return true if this File object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelFile _file = (ModelFile) o; + return Objects.equals(this.sourceURI, _file.sourceURI); + } + + @Override + public int hashCode() { + return Objects.hash(sourceURI); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelFile {\n"); + sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelList.java new file mode 100644 index 000000000000..769d5be8da1d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelList.java @@ -0,0 +1,113 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * ModelList + */ +@JsonPropertyOrder({ + ModelList.JSON_PROPERTY_123LIST +}) +@JsonTypeName("List") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ModelList { + public static final String JSON_PROPERTY_123LIST = "123-list"; + private String _123list; + + public ModelList() { + } + + public ModelList _123list(String _123list) { + this._123list = _123list; + return this; + } + + /** + * Get _123list + * @return _123list + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_123LIST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String get123list() { + return _123list; + } + + + @JsonProperty(JSON_PROPERTY_123LIST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void set123list(String _123list) { + this._123list = _123list; + } + + + /** + * Return true if this List object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelList _list = (ModelList) o; + return Objects.equals(this._123list, _list._123list); + } + + @Override + public int hashCode() { + return Objects.hash(_123list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelList {\n"); + sb.append(" _123list: ").append(toIndentedString(_123list)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelReturn.java new file mode 100644 index 000000000000..04b07c86af7d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Model for testing reserved words + */ +@ApiModel(description = "Model for testing reserved words") +@JsonPropertyOrder({ + ModelReturn.JSON_PROPERTY_RETURN +}) +@JsonTypeName("Return") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ModelReturn { + public static final String JSON_PROPERTY_RETURN = "return"; + private Integer _return; + + public ModelReturn() { + } + + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_RETURN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getReturn() { + return _return; + } + + + @JsonProperty(JSON_PROPERTY_RETURN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReturn(Integer _return) { + this._return = _return; + } + + + /** + * Return true if this Return object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + sb.append(" _return: ").append(toIndentedString(_return)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Name.java new file mode 100644 index 000000000000..698ddd071c0d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Name.java @@ -0,0 +1,199 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Model for testing model name same as property name + */ +@ApiModel(description = "Model for testing model name same as property name") +@JsonPropertyOrder({ + Name.JSON_PROPERTY_NAME, + Name.JSON_PROPERTY_SNAKE_CASE, + Name.JSON_PROPERTY_PROPERTY, + Name.JSON_PROPERTY_123NUMBER +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Name { + public static final String JSON_PROPERTY_NAME = "name"; + private Integer name; + + public static final String JSON_PROPERTY_SNAKE_CASE = "snake_case"; + private Integer snakeCase; + + public static final String JSON_PROPERTY_PROPERTY = "property"; + private String property; + + public static final String JSON_PROPERTY_123NUMBER = "123Number"; + private Integer _123number; + + public Name() { + } + + @JsonCreator + public Name( + @JsonProperty(JSON_PROPERTY_SNAKE_CASE) Integer snakeCase, + @JsonProperty(JSON_PROPERTY_123NUMBER) Integer _123number + ) { + this(); + this.snakeCase = snakeCase; + this._123number = _123number; + } + + public Name name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(Integer name) { + this.name = name; + } + + + /** + * Get snakeCase + * @return snakeCase + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SNAKE_CASE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getSnakeCase() { + return snakeCase; + } + + + + + public Name property(String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getProperty() { + return property; + } + + + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setProperty(String property) { + this.property = property; + } + + + /** + * Get _123number + * @return _123number + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_123NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer get123number() { + return _123number; + } + + + + + /** + * Return true if this Name object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123number: ").append(toIndentedString(_123number)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableClass.java new file mode 100644 index 000000000000..27e1b9666d19 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableClass.java @@ -0,0 +1,673 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * NullableClass + */ +@JsonPropertyOrder({ + NullableClass.JSON_PROPERTY_INTEGER_PROP, + NullableClass.JSON_PROPERTY_NUMBER_PROP, + NullableClass.JSON_PROPERTY_BOOLEAN_PROP, + NullableClass.JSON_PROPERTY_STRING_PROP, + NullableClass.JSON_PROPERTY_DATE_PROP, + NullableClass.JSON_PROPERTY_DATETIME_PROP, + NullableClass.JSON_PROPERTY_ARRAY_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, + NullableClass.JSON_PROPERTY_OBJECT_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class NullableClass { + public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; + private JsonNullable integerProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_NUMBER_PROP = "number_prop"; + private JsonNullable numberProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_BOOLEAN_PROP = "boolean_prop"; + private JsonNullable booleanProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_STRING_PROP = "string_prop"; + private JsonNullable stringProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DATE_PROP = "date_prop"; + private JsonNullable dateProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DATETIME_PROP = "datetime_prop"; + private JsonNullable datetimeProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + private JsonNullable> arrayNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + private JsonNullable> arrayAndItemsNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + private List arrayItemsNullable = null; + + public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + private JsonNullable> objectNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + private JsonNullable> objectAndItemsNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + private Map objectItemsNullable = null; + + public NullableClass() { + } + + public NullableClass integerProp(Integer integerProp) { + this.integerProp = JsonNullable.of(integerProp); + return this; + } + + /** + * Get integerProp + * @return integerProp + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Integer getIntegerProp() { + return integerProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getIntegerProp_JsonNullable() { + return integerProp; + } + + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + public void setIntegerProp_JsonNullable(JsonNullable integerProp) { + this.integerProp = integerProp; + } + + public void setIntegerProp(Integer integerProp) { + this.integerProp = JsonNullable.of(integerProp); + } + + + public NullableClass numberProp(BigDecimal numberProp) { + this.numberProp = JsonNullable.of(numberProp); + return this; + } + + /** + * Get numberProp + * @return numberProp + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public BigDecimal getNumberProp() { + return numberProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNumberProp_JsonNullable() { + return numberProp; + } + + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + public void setNumberProp_JsonNullable(JsonNullable numberProp) { + this.numberProp = numberProp; + } + + public void setNumberProp(BigDecimal numberProp) { + this.numberProp = JsonNullable.of(numberProp); + } + + + public NullableClass booleanProp(Boolean booleanProp) { + this.booleanProp = JsonNullable.of(booleanProp); + return this; + } + + /** + * Get booleanProp + * @return booleanProp + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Boolean getBooleanProp() { + return booleanProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getBooleanProp_JsonNullable() { + return booleanProp; + } + + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + public void setBooleanProp_JsonNullable(JsonNullable booleanProp) { + this.booleanProp = booleanProp; + } + + public void setBooleanProp(Boolean booleanProp) { + this.booleanProp = JsonNullable.of(booleanProp); + } + + + public NullableClass stringProp(String stringProp) { + this.stringProp = JsonNullable.of(stringProp); + return this; + } + + /** + * Get stringProp + * @return stringProp + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public String getStringProp() { + return stringProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STRING_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getStringProp_JsonNullable() { + return stringProp; + } + + @JsonProperty(JSON_PROPERTY_STRING_PROP) + public void setStringProp_JsonNullable(JsonNullable stringProp) { + this.stringProp = stringProp; + } + + public void setStringProp(String stringProp) { + this.stringProp = JsonNullable.of(stringProp); + } + + + public NullableClass dateProp(LocalDate dateProp) { + this.dateProp = JsonNullable.of(dateProp); + return this; + } + + /** + * Get dateProp + * @return dateProp + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public LocalDate getDateProp() { + return dateProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DATE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDateProp_JsonNullable() { + return dateProp; + } + + @JsonProperty(JSON_PROPERTY_DATE_PROP) + public void setDateProp_JsonNullable(JsonNullable dateProp) { + this.dateProp = dateProp; + } + + public void setDateProp(LocalDate dateProp) { + this.dateProp = JsonNullable.of(dateProp); + } + + + public NullableClass datetimeProp(OffsetDateTime datetimeProp) { + this.datetimeProp = JsonNullable.of(datetimeProp); + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public OffsetDateTime getDatetimeProp() { + return datetimeProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDatetimeProp_JsonNullable() { + return datetimeProp; + } + + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + public void setDatetimeProp_JsonNullable(JsonNullable datetimeProp) { + this.datetimeProp = datetimeProp; + } + + public void setDatetimeProp(OffsetDateTime datetimeProp) { + this.datetimeProp = JsonNullable.of(datetimeProp); + } + + + public NullableClass arrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = JsonNullable.>of(arrayNullableProp); + return this; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); + } + try { + this.arrayNullableProp.get().add(arrayNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public List getArrayNullableProp() { + return arrayNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getArrayNullableProp_JsonNullable() { + return arrayNullableProp; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + public void setArrayNullableProp_JsonNullable(JsonNullable> arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + public void setArrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = JsonNullable.>of(arrayNullableProp); + } + + + public NullableClass arrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = JsonNullable.>of(arrayAndItemsNullableProp); + return this; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + this.arrayAndItemsNullableProp = JsonNullable.>of(new ArrayList<>()); + } + try { + this.arrayAndItemsNullableProp.get().add(arrayAndItemsNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getArrayAndItemsNullableProp_JsonNullable() { + return arrayAndItemsNullableProp; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + public void setArrayAndItemsNullableProp_JsonNullable(JsonNullable> arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + public void setArrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = JsonNullable.>of(arrayAndItemsNullableProp); + } + + + public NullableClass arrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<>(); + } + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + /** + * Get arrayItemsNullable + * @return arrayItemsNullable + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + + @JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + + public NullableClass objectNullableProp(Map objectNullableProp) { + this.objectNullableProp = JsonNullable.>of(objectNullableProp); + return this; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null || !this.objectNullableProp.isPresent()) { + this.objectNullableProp = JsonNullable.>of(new HashMap<>()); + } + try { + this.objectNullableProp.get().put(key, objectNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Map getObjectNullableProp() { + return objectNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getObjectNullableProp_JsonNullable() { + return objectNullableProp; + } + + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + public void setObjectNullableProp_JsonNullable(JsonNullable> objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + public void setObjectNullableProp(Map objectNullableProp) { + this.objectNullableProp = JsonNullable.>of(objectNullableProp); + } + + + public NullableClass objectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = JsonNullable.>of(objectAndItemsNullableProp); + return this; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + this.objectAndItemsNullableProp = JsonNullable.>of(new HashMap<>()); + } + try { + this.objectAndItemsNullableProp.get().put(key, objectAndItemsNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getObjectAndItemsNullableProp_JsonNullable() { + return objectAndItemsNullableProp; + } + + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + public void setObjectAndItemsNullableProp_JsonNullable(JsonNullable> objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + public void setObjectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = JsonNullable.>of(objectAndItemsNullableProp); + } + + + public NullableClass objectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + return this; + } + + public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNullableItem) { + if (this.objectItemsNullable == null) { + this.objectItemsNullable = new HashMap<>(); + } + this.objectItemsNullable.put(key, objectItemsNullableItem); + return this; + } + + /** + * Get objectItemsNullable + * @return objectItemsNullable + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + + @JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public void setObjectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + /** + * 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. + */ + @JsonAnySetter + public NullableClass 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this NullableClass object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NullableClass nullableClass = (NullableClass) o; + return equalsNullable(this.integerProp, nullableClass.integerProp) && + equalsNullable(this.numberProp, nullableClass.numberProp) && + equalsNullable(this.booleanProp, nullableClass.booleanProp) && + equalsNullable(this.stringProp, nullableClass.stringProp) && + equalsNullable(this.dateProp, nullableClass.dateProp) && + equalsNullable(this.datetimeProp, nullableClass.datetimeProp) && + equalsNullable(this.arrayNullableProp, nullableClass.arrayNullableProp) && + equalsNullable(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) && + Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) && + equalsNullable(this.objectNullableProp, nullableClass.objectNullableProp) && + equalsNullable(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && + Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable)&& + Objects.equals(this.additionalProperties, nullableClass.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\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(" 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 "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableShape.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableShape.java new file mode 100644 index 000000000000..a9aa2bec867f --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableShape.java @@ -0,0 +1,337 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + +import com.fasterxml.jackson.core.type.TypeReference; + +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonDeserialize(using = NullableShape.NullableShapeDeserializer.class) +@JsonSerialize(using = NullableShape.NullableShapeSerializer.class) +public class NullableShape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(NullableShape.class.getName()); + + public static class NullableShapeSerializer extends StdSerializer { + public NullableShapeSerializer(Class t) { + super(t); + } + + public NullableShapeSerializer() { + this(null); + } + + @Override + public void serialize(NullableShape value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class NullableShapeDeserializer extends StdDeserializer { + public NullableShapeDeserializer() { + this(NullableShape.class); + } + + public NullableShapeDeserializer(Class vc) { + super(vc); + } + + @Override + public NullableShape deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + NullableShape newNullableShape = new NullableShape(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("shapeType"); + switch (discriminatorValue) { + case "Quadrilateral": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + newNullableShape.setActualInstance(deserialized); + return newNullableShape; + case "Triangle": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + newNullableShape.setActualInstance(deserialized); + return newNullableShape; + default: + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for NullableShape. Possible values: Quadrilateral Triangle", discriminatorValue)); + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Quadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + // deserialize Triangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + if (match == 1) { + NullableShape ret = new NullableShape(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for NullableShape: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public NullableShape getNullValue(DeserializationContext ctxt) throws JsonMappingException { + return null; + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public NullableShape() { + super("oneOf", Boolean.TRUE); + } + /** + * 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. + */ + @JsonAnySetter + public NullableShape 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this NullableShape object is equal to o. + */ + @Override + public boolean equals(Object o) { + return super.equals(o) && Objects.equals(this.additionalProperties, ((NullableShape)o).additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); + } + public NullableShape(Quadrilateral o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + public NullableShape(Triangle o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + static { + schemas.put("Quadrilateral", new GenericType() { + }); + schemas.put("Triangle", new GenericType() { + }); + JSON.registerDescendants(NullableShape.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Quadrilateral", Quadrilateral.class); + mappings.put("Triangle", Triangle.class); + mappings.put("NullableShape", NullableShape.class); + JSON.registerDiscriminator(NullableShape.class, "shapeType", mappings); + } + + @Override + public Map getSchemas() { + return NullableShape.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NumberOnly.java new file mode 100644 index 000000000000..37306290f7fa --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -0,0 +1,113 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * NumberOnly + */ +@JsonPropertyOrder({ + NumberOnly.JSON_PROPERTY_JUST_NUMBER +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class NumberOnly { + public static final String JSON_PROPERTY_JUST_NUMBER = "JustNumber"; + private BigDecimal justNumber; + + public NumberOnly() { + } + + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_JUST_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getJustNumber() { + return justNumber; + } + + + @JsonProperty(JSON_PROPERTY_JUST_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + /** + * Return true if this NumberOnly object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + sb.append(" justNumber: ").append(toIndentedString(justNumber)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java new file mode 100644 index 000000000000..54316fdd1504 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -0,0 +1,226 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.DeprecatedObject; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * ObjectWithDeprecatedFields + */ +@JsonPropertyOrder({ + ObjectWithDeprecatedFields.JSON_PROPERTY_UUID, + ObjectWithDeprecatedFields.JSON_PROPERTY_ID, + ObjectWithDeprecatedFields.JSON_PROPERTY_DEPRECATED_REF, + ObjectWithDeprecatedFields.JSON_PROPERTY_BARS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ObjectWithDeprecatedFields { + public static final String JSON_PROPERTY_UUID = "uuid"; + private String uuid; + + public static final String JSON_PROPERTY_ID = "id"; + private BigDecimal id; + + public static final String JSON_PROPERTY_DEPRECATED_REF = "deprecatedRef"; + private DeprecatedObject deprecatedRef; + + public static final String JSON_PROPERTY_BARS = "bars"; + private List bars = null; + + public ObjectWithDeprecatedFields() { + } + + public ObjectWithDeprecatedFields uuid(String uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUuid() { + return uuid; + } + + + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuid(String uuid) { + this.uuid = uuid; + } + + + public ObjectWithDeprecatedFields id(BigDecimal id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + * @deprecated + **/ + @Deprecated + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(BigDecimal id) { + this.id = id; + } + + + public ObjectWithDeprecatedFields deprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return this; + } + + /** + * Get deprecatedRef + * @return deprecatedRef + * @deprecated + **/ + @Deprecated + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DEPRECATED_REF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public DeprecatedObject getDeprecatedRef() { + return deprecatedRef; + } + + + @JsonProperty(JSON_PROPERTY_DEPRECATED_REF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + } + + + public ObjectWithDeprecatedFields bars(List bars) { + this.bars = bars; + return this; + } + + public ObjectWithDeprecatedFields addBarsItem(String barsItem) { + if (this.bars == null) { + this.bars = new ArrayList<>(); + } + this.bars.add(barsItem); + return this; + } + + /** + * Get bars + * @return bars + * @deprecated + **/ + @Deprecated + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BARS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getBars() { + return bars; + } + + + @JsonProperty(JSON_PROPERTY_BARS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBars(List bars) { + this.bars = bars; + } + + + /** + * Return true if this ObjectWithDeprecatedFields object is equal to o. + */ + @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 "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..b0e1ce4b02ed --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,310 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Order + */ +@JsonPropertyOrder({ + Order.JSON_PROPERTY_ID, + Order.JSON_PROPERTY_PET_ID, + Order.JSON_PROPERTY_QUANTITY, + Order.JSON_PROPERTY_SHIP_DATE, + Order.JSON_PROPERTY_STATUS, + Order.JSON_PROPERTY_COMPLETE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +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 OffsetDateTime shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + 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"; + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + private Boolean complete = false; + + public Order() { + } + + public Order id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getPetId() { + return petId; + } + + + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPetId(Long petId) { + this.petId = petId; + } + + + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getQuantity() { + return quantity; + } + + + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(example = "2020-02-02T20:20:20.000222Z", value = "") + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getShipDate() { + return shipDate; + } + + + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShipDate(OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "Order Status") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getComplete() { + return complete; + } + + + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + /** + * Return true if this Order object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @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 String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterComposite.java new file mode 100644 index 000000000000..d71b453ac269 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -0,0 +1,177 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * OuterComposite + */ +@JsonPropertyOrder({ + OuterComposite.JSON_PROPERTY_MY_NUMBER, + OuterComposite.JSON_PROPERTY_MY_STRING, + OuterComposite.JSON_PROPERTY_MY_BOOLEAN +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OuterComposite { + public static final String JSON_PROPERTY_MY_NUMBER = "my_number"; + private BigDecimal myNumber; + + public static final String JSON_PROPERTY_MY_STRING = "my_string"; + private String myString; + + public static final String JSON_PROPERTY_MY_BOOLEAN = "my_boolean"; + private Boolean myBoolean; + + public OuterComposite() { + } + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getMyNumber() { + return myNumber; + } + + + @JsonProperty(JSON_PROPERTY_MY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMyString() { + return myString; + } + + + @JsonProperty(JSON_PROPERTY_MY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMyString(String myString) { + this.myString = myString; + } + + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMyBoolean() { + return myBoolean; + } + + + @JsonProperty(JSON_PROPERTY_MY_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + /** + * Return true if this OuterComposite object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnum.java new file mode 100644 index 000000000000..a2c3043d7629 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String value) { + for (OuterEnum b : OuterEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..a7437d939b36 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +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; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + 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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumInteger.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumInteger.java new file mode 100644 index 000000000000..d937d68bc1f7 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumInteger.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +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; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + 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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..fa04cfa387bd --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +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; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + 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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ParentPet.java new file mode 100644 index 000000000000..ae48ed08a859 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ParentPet.java @@ -0,0 +1,144 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ChildCat; +import org.openapitools.client.model.GrandparentAnimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * ParentPet + */ +@JsonPropertyOrder({ +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonIgnoreProperties( + value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the pet_type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ChildCat.class, name = "ChildCat"), +}) + +public class ParentPet extends GrandparentAnimal { + public ParentPet() { + } + /** + * 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. + */ + @JsonAnySetter + public ParentPet 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this ParentPet object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParentPet {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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 "); + } + +static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("ChildCat", ChildCat.class); + mappings.put("ParentPet", ParentPet.class); + JSON.registerDiscriminator(ParentPet.class, "pet_type", mappings); +} +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..a338a90dc864 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,326 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Pet + */ +@JsonPropertyOrder({ + Pet.JSON_PROPERTY_ID, + Pet.JSON_PROPERTY_CATEGORY, + Pet.JSON_PROPERTY_NAME, + Pet.JSON_PROPERTY_PHOTO_URLS, + Pet.JSON_PROPERTY_TAGS, + Pet.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +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; + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + 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"; + private StatusEnum status; + + public Pet() { + } + + public Pet id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + + public Pet category(Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(Category category) { + this.category = category; + } + + + public Pet name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(String name) { + this.name = name; + } + + + public Pet photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + + 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; + } + + /** + * Get tags + * @return tags + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getTags() { + return tags; + } + + + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(List tags) { + this.tags = tags; + } + + + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "pet status in the store") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(StatusEnum status) { + this.status = status; + } + + + /** + * Return true if this Pet object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @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 String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pig.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pig.java new file mode 100644 index 000000000000..b283e1387503 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pig.java @@ -0,0 +1,330 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.DanishPig; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + +import com.fasterxml.jackson.core.type.TypeReference; + +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonDeserialize(using = Pig.PigDeserializer.class) +@JsonSerialize(using = Pig.PigSerializer.class) +public class Pig extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Pig.class.getName()); + + public static class PigSerializer extends StdSerializer { + public PigSerializer(Class t) { + super(t); + } + + public PigSerializer() { + this(null); + } + + @Override + public void serialize(Pig value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class PigDeserializer extends StdDeserializer { + public PigDeserializer() { + this(Pig.class); + } + + public PigDeserializer(Class vc) { + super(vc); + } + + @Override + public Pig deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Pig newPig = new Pig(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("className"); + switch (discriminatorValue) { + case "BasquePig": + deserialized = tree.traverse(jp.getCodec()).readValueAs(BasquePig.class); + newPig.setActualInstance(deserialized); + return newPig; + case "DanishPig": + deserialized = tree.traverse(jp.getCodec()).readValueAs(DanishPig.class); + newPig.setActualInstance(deserialized); + return newPig; + default: + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for Pig. Possible values: BasquePig DanishPig", discriminatorValue)); + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize BasquePig + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (BasquePig.class.equals(Integer.class) || BasquePig.class.equals(Long.class) || BasquePig.class.equals(Float.class) || BasquePig.class.equals(Double.class) || BasquePig.class.equals(Boolean.class) || BasquePig.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((BasquePig.class.equals(Integer.class) || BasquePig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((BasquePig.class.equals(Float.class) || BasquePig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (BasquePig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (BasquePig.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(BasquePig.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'BasquePig'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'BasquePig'", e); + } + + // deserialize DanishPig + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DanishPig.class.equals(Integer.class) || DanishPig.class.equals(Long.class) || DanishPig.class.equals(Float.class) || DanishPig.class.equals(Double.class) || DanishPig.class.equals(Boolean.class) || DanishPig.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((DanishPig.class.equals(Integer.class) || DanishPig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((DanishPig.class.equals(Float.class) || DanishPig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (DanishPig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (DanishPig.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(DanishPig.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'DanishPig'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DanishPig'", e); + } + + if (match == 1) { + Pig ret = new Pig(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for Pig: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Pig getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Pig cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public Pig() { + super("oneOf", Boolean.FALSE); + } + /** + * 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. + */ + @JsonAnySetter + public Pig 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this Pig object is equal to o. + */ + @Override + public boolean equals(Object o) { + return super.equals(o) && Objects.equals(this.additionalProperties, ((Pig)o).additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); + } + public Pig(BasquePig o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Pig(DanishPig o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("BasquePig", new GenericType() { + }); + schemas.put("DanishPig", new GenericType() { + }); + JSON.registerDescendants(Pig.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("BasquePig", BasquePig.class); + mappings.put("DanishPig", DanishPig.class); + mappings.put("Pig", Pig.class); + JSON.registerDiscriminator(Pig.class, "className", mappings); + } + + @Override + public Map getSchemas() { + return Pig.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * BasquePig, DanishPig + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(BasquePig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(DanishPig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BasquePig, DanishPig"); + } + + /** + * Get the actual instance, which can be the following: + * BasquePig, DanishPig + * + * @return The actual instance (BasquePig, DanishPig) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BasquePig`. If the actual instance is not `BasquePig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BasquePig` + * @throws ClassCastException if the instance is not `BasquePig` + */ + public BasquePig getBasquePig() throws ClassCastException { + return (BasquePig)super.getActualInstance(); + } + + /** + * Get the actual instance of `DanishPig`. If the actual instance is not `DanishPig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `DanishPig` + * @throws ClassCastException if the instance is not `DanishPig` + */ + public DanishPig getDanishPig() throws ClassCastException { + return (DanishPig)super.getActualInstance(); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Quadrilateral.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Quadrilateral.java new file mode 100644 index 000000000000..0af291d6ef50 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Quadrilateral.java @@ -0,0 +1,330 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + +import com.fasterxml.jackson.core.type.TypeReference; + +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonDeserialize(using = Quadrilateral.QuadrilateralDeserializer.class) +@JsonSerialize(using = Quadrilateral.QuadrilateralSerializer.class) +public class Quadrilateral extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Quadrilateral.class.getName()); + + public static class QuadrilateralSerializer extends StdSerializer { + public QuadrilateralSerializer(Class t) { + super(t); + } + + public QuadrilateralSerializer() { + this(null); + } + + @Override + public void serialize(Quadrilateral value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class QuadrilateralDeserializer extends StdDeserializer { + public QuadrilateralDeserializer() { + this(Quadrilateral.class); + } + + public QuadrilateralDeserializer(Class vc) { + super(vc); + } + + @Override + public Quadrilateral deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Quadrilateral newQuadrilateral = new Quadrilateral(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("quadrilateralType"); + switch (discriminatorValue) { + case "ComplexQuadrilateral": + deserialized = tree.traverse(jp.getCodec()).readValueAs(ComplexQuadrilateral.class); + newQuadrilateral.setActualInstance(deserialized); + return newQuadrilateral; + case "SimpleQuadrilateral": + deserialized = tree.traverse(jp.getCodec()).readValueAs(SimpleQuadrilateral.class); + newQuadrilateral.setActualInstance(deserialized); + return newQuadrilateral; + default: + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for Quadrilateral. Possible values: ComplexQuadrilateral SimpleQuadrilateral", discriminatorValue)); + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize ComplexQuadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ComplexQuadrilateral.class.equals(Integer.class) || ComplexQuadrilateral.class.equals(Long.class) || ComplexQuadrilateral.class.equals(Float.class) || ComplexQuadrilateral.class.equals(Double.class) || ComplexQuadrilateral.class.equals(Boolean.class) || ComplexQuadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((ComplexQuadrilateral.class.equals(Integer.class) || ComplexQuadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((ComplexQuadrilateral.class.equals(Float.class) || ComplexQuadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (ComplexQuadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (ComplexQuadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(ComplexQuadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'ComplexQuadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ComplexQuadrilateral'", e); + } + + // deserialize SimpleQuadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SimpleQuadrilateral.class.equals(Integer.class) || SimpleQuadrilateral.class.equals(Long.class) || SimpleQuadrilateral.class.equals(Float.class) || SimpleQuadrilateral.class.equals(Double.class) || SimpleQuadrilateral.class.equals(Boolean.class) || SimpleQuadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((SimpleQuadrilateral.class.equals(Integer.class) || SimpleQuadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((SimpleQuadrilateral.class.equals(Float.class) || SimpleQuadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (SimpleQuadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (SimpleQuadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SimpleQuadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'SimpleQuadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SimpleQuadrilateral'", e); + } + + if (match == 1) { + Quadrilateral ret = new Quadrilateral(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for Quadrilateral: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Quadrilateral getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Quadrilateral cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public Quadrilateral() { + super("oneOf", Boolean.FALSE); + } + /** + * 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. + */ + @JsonAnySetter + public Quadrilateral 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this Quadrilateral object is equal to o. + */ + @Override + public boolean equals(Object o) { + return super.equals(o) && Objects.equals(this.additionalProperties, ((Quadrilateral)o).additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); + } + public Quadrilateral(ComplexQuadrilateral o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Quadrilateral(SimpleQuadrilateral o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("ComplexQuadrilateral", new GenericType() { + }); + schemas.put("SimpleQuadrilateral", new GenericType() { + }); + JSON.registerDescendants(Quadrilateral.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("ComplexQuadrilateral", ComplexQuadrilateral.class); + mappings.put("SimpleQuadrilateral", SimpleQuadrilateral.class); + mappings.put("Quadrilateral", Quadrilateral.class); + JSON.registerDiscriminator(Quadrilateral.class, "quadrilateralType", mappings); + } + + @Override + public Map getSchemas() { + return Quadrilateral.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * ComplexQuadrilateral, SimpleQuadrilateral + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ComplexQuadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(SimpleQuadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be ComplexQuadrilateral, SimpleQuadrilateral"); + } + + /** + * Get the actual instance, which can be the following: + * ComplexQuadrilateral, SimpleQuadrilateral + * + * @return The actual instance (ComplexQuadrilateral, SimpleQuadrilateral) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ComplexQuadrilateral`. If the actual instance is not `ComplexQuadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ComplexQuadrilateral` + * @throws ClassCastException if the instance is not `ComplexQuadrilateral` + */ + public ComplexQuadrilateral getComplexQuadrilateral() throws ClassCastException { + return (ComplexQuadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `SimpleQuadrilateral`. If the actual instance is not `SimpleQuadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SimpleQuadrilateral` + * @throws ClassCastException if the instance is not `SimpleQuadrilateral` + */ + public SimpleQuadrilateral getSimpleQuadrilateral() throws ClassCastException { + return (SimpleQuadrilateral)super.getActualInstance(); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java new file mode 100644 index 000000000000..b6d3b20f1b77 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -0,0 +1,112 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * QuadrilateralInterface + */ +@JsonPropertyOrder({ + QuadrilateralInterface.JSON_PROPERTY_QUADRILATERAL_TYPE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class QuadrilateralInterface { + public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType"; + private String quadrilateralType; + + public QuadrilateralInterface() { + } + + public QuadrilateralInterface quadrilateralType(String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setQuadrilateralType(String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + + /** + * Return true if this QuadrilateralInterface object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QuadrilateralInterface quadrilateralInterface = (QuadrilateralInterface) o; + return Objects.equals(this.quadrilateralType, quadrilateralInterface.quadrilateralType); + } + + @Override + public int hashCode() { + return Objects.hash(quadrilateralType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuadrilateralInterface {\n"); + sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..1111f67f3835 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -0,0 +1,142 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * ReadOnlyFirst + */ +@JsonPropertyOrder({ + ReadOnlyFirst.JSON_PROPERTY_BAR, + ReadOnlyFirst.JSON_PROPERTY_BAZ +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReadOnlyFirst { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar; + + public static final String JSON_PROPERTY_BAZ = "baz"; + private String baz; + + public ReadOnlyFirst() { + } + + @JsonCreator + public ReadOnlyFirst( + @JsonProperty(JSON_PROPERTY_BAR) String bar + ) { + this(); + this.bar = bar; + } + + /** + * Get bar + * @return bar + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAZ) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBaz() { + return baz; + } + + + @JsonProperty(JSON_PROPERTY_BAZ) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBaz(String baz) { + this.baz = baz; + } + + + /** + * Return true if this ReadOnlyFirst object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java new file mode 100644 index 000000000000..15bc62cc8e60 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -0,0 +1,189 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * ScaleneTriangle + */ +@JsonPropertyOrder({ + ScaleneTriangle.JSON_PROPERTY_SHAPE_TYPE, + ScaleneTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ScaleneTriangle { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + private String shapeType; + + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + private String triangleType; + + public ScaleneTriangle() { + } + + public ScaleneTriangle shapeType(String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public ScaleneTriangle triangleType(String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTriangleType(String triangleType) { + this.triangleType = triangleType; + } + + /** + * 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. + */ + @JsonAnySetter + public ScaleneTriangle 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this ScaleneTriangle object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScaleneTriangle scaleneTriangle = (ScaleneTriangle) o; + return Objects.equals(this.shapeType, scaleneTriangle.shapeType) && + Objects.equals(this.triangleType, scaleneTriangle.triangleType)&& + Objects.equals(this.additionalProperties, scaleneTriangle.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(shapeType, triangleType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScaleneTriangle {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" triangleType: ").append(toIndentedString(triangleType)).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 "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Shape.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Shape.java new file mode 100644 index 000000000000..15f9fc173c07 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Shape.java @@ -0,0 +1,330 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + +import com.fasterxml.jackson.core.type.TypeReference; + +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonDeserialize(using = Shape.ShapeDeserializer.class) +@JsonSerialize(using = Shape.ShapeSerializer.class) +public class Shape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Shape.class.getName()); + + public static class ShapeSerializer extends StdSerializer { + public ShapeSerializer(Class t) { + super(t); + } + + public ShapeSerializer() { + this(null); + } + + @Override + public void serialize(Shape value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ShapeDeserializer extends StdDeserializer { + public ShapeDeserializer() { + this(Shape.class); + } + + public ShapeDeserializer(Class vc) { + super(vc); + } + + @Override + public Shape deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Shape newShape = new Shape(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("shapeType"); + switch (discriminatorValue) { + case "Quadrilateral": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + newShape.setActualInstance(deserialized); + return newShape; + case "Triangle": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + newShape.setActualInstance(deserialized); + return newShape; + default: + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for Shape. Possible values: Quadrilateral Triangle", discriminatorValue)); + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Quadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + // deserialize Triangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + if (match == 1) { + Shape ret = new Shape(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for Shape: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Shape getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Shape cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public Shape() { + super("oneOf", Boolean.FALSE); + } + /** + * 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. + */ + @JsonAnySetter + public Shape 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this Shape object is equal to o. + */ + @Override + public boolean equals(Object o) { + return super.equals(o) && Objects.equals(this.additionalProperties, ((Shape)o).additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); + } + public Shape(Quadrilateral o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Shape(Triangle o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Quadrilateral", new GenericType() { + }); + schemas.put("Triangle", new GenericType() { + }); + JSON.registerDescendants(Shape.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Quadrilateral", Quadrilateral.class); + mappings.put("Triangle", Triangle.class); + mappings.put("Shape", Shape.class); + JSON.registerDiscriminator(Shape.class, "shapeType", mappings); + } + + @Override + public Map getSchemas() { + return Shape.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeInterface.java new file mode 100644 index 000000000000..68765950594d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -0,0 +1,112 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * ShapeInterface + */ +@JsonPropertyOrder({ + ShapeInterface.JSON_PROPERTY_SHAPE_TYPE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ShapeInterface { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + private String shapeType; + + public ShapeInterface() { + } + + public ShapeInterface shapeType(String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + /** + * Return true if this ShapeInterface object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShapeInterface shapeInterface = (ShapeInterface) o; + return Objects.equals(this.shapeType, shapeInterface.shapeType); + } + + @Override + public int hashCode() { + return Objects.hash(shapeType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShapeInterface {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeOrNull.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeOrNull.java new file mode 100644 index 000000000000..8bdc28cb7860 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeOrNull.java @@ -0,0 +1,337 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + +import com.fasterxml.jackson.core.type.TypeReference; + +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonDeserialize(using = ShapeOrNull.ShapeOrNullDeserializer.class) +@JsonSerialize(using = ShapeOrNull.ShapeOrNullSerializer.class) +public class ShapeOrNull extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ShapeOrNull.class.getName()); + + public static class ShapeOrNullSerializer extends StdSerializer { + public ShapeOrNullSerializer(Class t) { + super(t); + } + + public ShapeOrNullSerializer() { + this(null); + } + + @Override + public void serialize(ShapeOrNull value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ShapeOrNullDeserializer extends StdDeserializer { + public ShapeOrNullDeserializer() { + this(ShapeOrNull.class); + } + + public ShapeOrNullDeserializer(Class vc) { + super(vc); + } + + @Override + public ShapeOrNull deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + ShapeOrNull newShapeOrNull = new ShapeOrNull(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("shapeType"); + switch (discriminatorValue) { + case "Quadrilateral": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + newShapeOrNull.setActualInstance(deserialized); + return newShapeOrNull; + case "Triangle": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + newShapeOrNull.setActualInstance(deserialized); + return newShapeOrNull; + default: + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for ShapeOrNull. Possible values: Quadrilateral Triangle", discriminatorValue)); + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Quadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + // deserialize Triangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + if (match == 1) { + ShapeOrNull ret = new ShapeOrNull(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for ShapeOrNull: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public ShapeOrNull getNullValue(DeserializationContext ctxt) throws JsonMappingException { + return null; + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public ShapeOrNull() { + super("oneOf", Boolean.TRUE); + } + /** + * 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. + */ + @JsonAnySetter + public ShapeOrNull 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this ShapeOrNull object is equal to o. + */ + @Override + public boolean equals(Object o) { + return super.equals(o) && Objects.equals(this.additionalProperties, ((ShapeOrNull)o).additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); + } + public ShapeOrNull(Quadrilateral o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + public ShapeOrNull(Triangle o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + static { + schemas.put("Quadrilateral", new GenericType() { + }); + schemas.put("Triangle", new GenericType() { + }); + JSON.registerDescendants(ShapeOrNull.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Quadrilateral", Quadrilateral.class); + mappings.put("Triangle", Triangle.class); + mappings.put("ShapeOrNull", ShapeOrNull.class); + JSON.registerDiscriminator(ShapeOrNull.class, "shapeType", mappings); + } + + @Override + public Map getSchemas() { + return ShapeOrNull.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java new file mode 100644 index 000000000000..87fcfee6f40a --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -0,0 +1,189 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.QuadrilateralInterface; +import org.openapitools.client.model.ShapeInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * SimpleQuadrilateral + */ +@JsonPropertyOrder({ + SimpleQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, + SimpleQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SimpleQuadrilateral { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + private String shapeType; + + public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType"; + private String quadrilateralType; + + public SimpleQuadrilateral() { + } + + public SimpleQuadrilateral shapeType(String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public SimpleQuadrilateral quadrilateralType(String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setQuadrilateralType(String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * 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. + */ + @JsonAnySetter + public SimpleQuadrilateral 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this SimpleQuadrilateral object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SimpleQuadrilateral simpleQuadrilateral = (SimpleQuadrilateral) o; + return Objects.equals(this.shapeType, simpleQuadrilateral.shapeType) && + Objects.equals(this.quadrilateralType, simpleQuadrilateral.quadrilateralType)&& + Objects.equals(this.additionalProperties, simpleQuadrilateral.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(shapeType, quadrilateralType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SimpleQuadrilateral {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).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 "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SpecialModelName.java new file mode 100644 index 000000000000..08e0f972e5c2 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -0,0 +1,145 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * SpecialModelName + */ +@JsonPropertyOrder({ + SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME, + SpecialModelName.JSON_PROPERTY_SPECIAL_MODEL_NAME +}) +@JsonTypeName("_special_model.name_") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SpecialModelName { + public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + private Long $specialPropertyName; + + public static final String JSON_PROPERTY_SPECIAL_MODEL_NAME = "_special_model.name_"; + private String specialModelName; + + public SpecialModelName() { + } + + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + + @JsonProperty(JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + public SpecialModelName specialModelName(String specialModelName) { + this.specialModelName = specialModelName; + return this; + } + + /** + * Get specialModelName + * @return specialModelName + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SPECIAL_MODEL_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSpecialModelName() { + return specialModelName; + } + + + @JsonProperty(JSON_PROPERTY_SPECIAL_MODEL_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSpecialModelName(String specialModelName) { + this.specialModelName = specialModelName; + } + + + /** + * Return true if this _special_model.name_ object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName) && + Objects.equals(this.specialModelName, specialModelName.specialModelName); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName, specialModelName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append(" specialModelName: ").append(toIndentedString(specialModelName)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..6b15559ee319 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,144 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Tag + */ +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +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; + + public Tag() { + } + + public Tag id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + + public Tag name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + + /** + * Return true if this Tag object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @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 String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Triangle.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Triangle.java new file mode 100644 index 000000000000..8df5a0a77cbf --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Triangle.java @@ -0,0 +1,385 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.EquilateralTriangle; +import org.openapitools.client.model.IsoscelesTriangle; +import org.openapitools.client.model.ScaleneTriangle; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + +import com.fasterxml.jackson.core.type.TypeReference; + +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@JsonDeserialize(using = Triangle.TriangleDeserializer.class) +@JsonSerialize(using = Triangle.TriangleSerializer.class) +public class Triangle extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Triangle.class.getName()); + + public static class TriangleSerializer extends StdSerializer { + public TriangleSerializer(Class t) { + super(t); + } + + public TriangleSerializer() { + this(null); + } + + @Override + public void serialize(Triangle value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class TriangleDeserializer extends StdDeserializer { + public TriangleDeserializer() { + this(Triangle.class); + } + + public TriangleDeserializer(Class vc) { + super(vc); + } + + @Override + public Triangle deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Triangle newTriangle = new Triangle(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("triangleType"); + switch (discriminatorValue) { + case "EquilateralTriangle": + deserialized = tree.traverse(jp.getCodec()).readValueAs(EquilateralTriangle.class); + newTriangle.setActualInstance(deserialized); + return newTriangle; + case "IsoscelesTriangle": + deserialized = tree.traverse(jp.getCodec()).readValueAs(IsoscelesTriangle.class); + newTriangle.setActualInstance(deserialized); + return newTriangle; + case "ScaleneTriangle": + deserialized = tree.traverse(jp.getCodec()).readValueAs(ScaleneTriangle.class); + newTriangle.setActualInstance(deserialized); + return newTriangle; + default: + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for Triangle. Possible values: EquilateralTriangle IsoscelesTriangle ScaleneTriangle", discriminatorValue)); + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize EquilateralTriangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (EquilateralTriangle.class.equals(Integer.class) || EquilateralTriangle.class.equals(Long.class) || EquilateralTriangle.class.equals(Float.class) || EquilateralTriangle.class.equals(Double.class) || EquilateralTriangle.class.equals(Boolean.class) || EquilateralTriangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((EquilateralTriangle.class.equals(Integer.class) || EquilateralTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((EquilateralTriangle.class.equals(Float.class) || EquilateralTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (EquilateralTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (EquilateralTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(EquilateralTriangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'EquilateralTriangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'EquilateralTriangle'", e); + } + + // deserialize IsoscelesTriangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (IsoscelesTriangle.class.equals(Integer.class) || IsoscelesTriangle.class.equals(Long.class) || IsoscelesTriangle.class.equals(Float.class) || IsoscelesTriangle.class.equals(Double.class) || IsoscelesTriangle.class.equals(Boolean.class) || IsoscelesTriangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((IsoscelesTriangle.class.equals(Integer.class) || IsoscelesTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((IsoscelesTriangle.class.equals(Float.class) || IsoscelesTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (IsoscelesTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (IsoscelesTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(IsoscelesTriangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'IsoscelesTriangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'IsoscelesTriangle'", e); + } + + // deserialize ScaleneTriangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ScaleneTriangle.class.equals(Integer.class) || ScaleneTriangle.class.equals(Long.class) || ScaleneTriangle.class.equals(Float.class) || ScaleneTriangle.class.equals(Double.class) || ScaleneTriangle.class.equals(Boolean.class) || ScaleneTriangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((ScaleneTriangle.class.equals(Integer.class) || ScaleneTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((ScaleneTriangle.class.equals(Float.class) || ScaleneTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (ScaleneTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (ScaleneTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(ScaleneTriangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'ScaleneTriangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ScaleneTriangle'", e); + } + + if (match == 1) { + Triangle ret = new Triangle(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for Triangle: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Triangle getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Triangle cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public Triangle() { + super("oneOf", Boolean.FALSE); + } + /** + * 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. + */ + @JsonAnySetter + public Triangle 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this Triangle object is equal to o. + */ + @Override + public boolean equals(Object o) { + return super.equals(o) && Objects.equals(this.additionalProperties, ((Triangle)o).additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); + } + public Triangle(EquilateralTriangle o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Triangle(IsoscelesTriangle o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Triangle(ScaleneTriangle o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("EquilateralTriangle", new GenericType() { + }); + schemas.put("IsoscelesTriangle", new GenericType() { + }); + schemas.put("ScaleneTriangle", new GenericType() { + }); + JSON.registerDescendants(Triangle.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("EquilateralTriangle", EquilateralTriangle.class); + mappings.put("IsoscelesTriangle", IsoscelesTriangle.class); + mappings.put("ScaleneTriangle", ScaleneTriangle.class); + mappings.put("Triangle", Triangle.class); + JSON.registerDiscriminator(Triangle.class, "triangleType", mappings); + } + + @Override + public Map getSchemas() { + return Triangle.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(EquilateralTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(IsoscelesTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(ScaleneTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle"); + } + + /** + * Get the actual instance, which can be the following: + * EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle + * + * @return The actual instance (EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `EquilateralTriangle`. If the actual instance is not `EquilateralTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EquilateralTriangle` + * @throws ClassCastException if the instance is not `EquilateralTriangle` + */ + public EquilateralTriangle getEquilateralTriangle() throws ClassCastException { + return (EquilateralTriangle)super.getActualInstance(); + } + + /** + * Get the actual instance of `IsoscelesTriangle`. If the actual instance is not `IsoscelesTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `IsoscelesTriangle` + * @throws ClassCastException if the instance is not `IsoscelesTriangle` + */ + public IsoscelesTriangle getIsoscelesTriangle() throws ClassCastException { + return (IsoscelesTriangle)super.getActualInstance(); + } + + /** + * Get the actual instance of `ScaleneTriangle`. If the actual instance is not `ScaleneTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ScaleneTriangle` + * @throws ClassCastException if the instance is not `ScaleneTriangle` + */ + public ScaleneTriangle getScaleneTriangle() throws ClassCastException { + return (ScaleneTriangle)super.getActualInstance(); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/TriangleInterface.java new file mode 100644 index 000000000000..ce693260bbfc --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -0,0 +1,112 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * TriangleInterface + */ +@JsonPropertyOrder({ + TriangleInterface.JSON_PROPERTY_TRIANGLE_TYPE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TriangleInterface { + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + private String triangleType; + + public TriangleInterface() { + } + + public TriangleInterface triangleType(String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTriangleType(String triangleType) { + this.triangleType = triangleType; + } + + + /** + * Return true if this TriangleInterface object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TriangleInterface triangleInterface = (TriangleInterface) o; + return Objects.equals(this.triangleType, triangleInterface.triangleType); + } + + @Override + public int hashCode() { + return Objects.hash(triangleType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TriangleInterface {\n"); + sb.append(" triangleType: ").append(toIndentedString(triangleType)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..eae5b4e785d3 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,503 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * User + */ +@JsonPropertyOrder({ + User.JSON_PROPERTY_ID, + User.JSON_PROPERTY_USERNAME, + User.JSON_PROPERTY_FIRST_NAME, + User.JSON_PROPERTY_LAST_NAME, + User.JSON_PROPERTY_EMAIL, + User.JSON_PROPERTY_PASSWORD, + User.JSON_PROPERTY_PHONE, + User.JSON_PROPERTY_USER_STATUS, + User.JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS, + User.JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE, + User.JSON_PROPERTY_ANY_TYPE_PROP, + User.JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +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"; + private Integer userStatus; + + public static final String JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS = "objectWithNoDeclaredProps"; + private Object objectWithNoDeclaredProps; + + public static final String JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE = "objectWithNoDeclaredPropsNullable"; + private JsonNullable objectWithNoDeclaredPropsNullable = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ANY_TYPE_PROP = "anyTypeProp"; + private JsonNullable anyTypeProp = JsonNullable.of(null); + + public static final String JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE = "anyTypePropNullable"; + private JsonNullable anyTypePropNullable = JsonNullable.of(null); + + public User() { + } + + public User id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + + public User username(String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUsername() { + return username; + } + + + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUsername(String username) { + this.username = username; + } + + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getFirstName() { + return firstName; + } + + + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getLastName() { + return lastName; + } + + + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLastName(String lastName) { + this.lastName = lastName; + } + + + public User email(String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getEmail() { + return email; + } + + + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmail(String email) { + this.email = email; + } + + + public User password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPassword() { + return password; + } + + + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPassword(String password) { + this.password = password; + } + + + public User phone(String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPhone() { + return phone; + } + + + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPhone(String phone) { + this.phone = phone; + } + + + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "User Status") + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getUserStatus() { + return userStatus; + } + + + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + public User objectWithNoDeclaredProps(Object objectWithNoDeclaredProps) { + this.objectWithNoDeclaredProps = objectWithNoDeclaredProps; + return this; + } + + /** + * test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + * @return objectWithNoDeclaredProps + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value.") + @JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getObjectWithNoDeclaredProps() { + return objectWithNoDeclaredProps; + } + + + @JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setObjectWithNoDeclaredProps(Object objectWithNoDeclaredProps) { + this.objectWithNoDeclaredProps = objectWithNoDeclaredProps; + } + + + public User objectWithNoDeclaredPropsNullable(Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = JsonNullable.of(objectWithNoDeclaredPropsNullable); + return this; + } + + /** + * test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + * @return objectWithNoDeclaredPropsNullable + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "test code generation for nullable objects. Value must be a map of strings to values or the 'null' value.") + @JsonIgnore + + public Object getObjectWithNoDeclaredPropsNullable() { + return objectWithNoDeclaredPropsNullable.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getObjectWithNoDeclaredPropsNullable_JsonNullable() { + return objectWithNoDeclaredPropsNullable; + } + + @JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE) + public void setObjectWithNoDeclaredPropsNullable_JsonNullable(JsonNullable objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + } + + public void setObjectWithNoDeclaredPropsNullable(Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = JsonNullable.of(objectWithNoDeclaredPropsNullable); + } + + + public User anyTypeProp(Object anyTypeProp) { + this.anyTypeProp = JsonNullable.of(anyTypeProp); + return this; + } + + /** + * test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + * @return anyTypeProp + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389") + @JsonIgnore + + public Object getAnyTypeProp() { + return anyTypeProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAnyTypeProp_JsonNullable() { + return anyTypeProp; + } + + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP) + public void setAnyTypeProp_JsonNullable(JsonNullable anyTypeProp) { + this.anyTypeProp = anyTypeProp; + } + + public void setAnyTypeProp(Object anyTypeProp) { + this.anyTypeProp = JsonNullable.of(anyTypeProp); + } + + + public User anyTypePropNullable(Object anyTypePropNullable) { + this.anyTypePropNullable = JsonNullable.of(anyTypePropNullable); + return this; + } + + /** + * test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. + * @return anyTypePropNullable + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values.") + @JsonIgnore + + public Object getAnyTypePropNullable() { + return anyTypePropNullable.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAnyTypePropNullable_JsonNullable() { + return anyTypePropNullable; + } + + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE) + public void setAnyTypePropNullable_JsonNullable(JsonNullable anyTypePropNullable) { + this.anyTypePropNullable = anyTypePropNullable; + } + + public void setAnyTypePropNullable(Object anyTypePropNullable) { + this.anyTypePropNullable = JsonNullable.of(anyTypePropNullable); + } + + + /** + * Return true if this User object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus) && + Objects.equals(this.objectWithNoDeclaredProps, user.objectWithNoDeclaredProps) && + equalsNullable(this.objectWithNoDeclaredPropsNullable, user.objectWithNoDeclaredPropsNullable) && + equalsNullable(this.anyTypeProp, user.anyTypeProp) && + equalsNullable(this.anyTypePropNullable, user.anyTypePropNullable); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, objectWithNoDeclaredProps, hashCodeNullable(objectWithNoDeclaredPropsNullable), hashCodeNullable(anyTypeProp), hashCodeNullable(anyTypePropNullable)); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @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(" objectWithNoDeclaredProps: ").append(toIndentedString(objectWithNoDeclaredProps)).append("\n"); + sb.append(" objectWithNoDeclaredPropsNullable: ").append(toIndentedString(objectWithNoDeclaredPropsNullable)).append("\n"); + sb.append(" anyTypeProp: ").append(toIndentedString(anyTypeProp)).append("\n"); + sb.append(" anyTypePropNullable: ").append(toIndentedString(anyTypePropNullable)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Whale.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Whale.java new file mode 100644 index 000000000000..6cda7a62a92a --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Whale.java @@ -0,0 +1,177 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Whale + */ +@JsonPropertyOrder({ + Whale.JSON_PROPERTY_HAS_BALEEN, + Whale.JSON_PROPERTY_HAS_TEETH, + Whale.JSON_PROPERTY_CLASS_NAME +}) +@JsonTypeName("whale") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Whale { + public static final String JSON_PROPERTY_HAS_BALEEN = "hasBaleen"; + private Boolean hasBaleen; + + public static final String JSON_PROPERTY_HAS_TEETH = "hasTeeth"; + private Boolean hasTeeth; + + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + private String className; + + public Whale() { + } + + public Whale hasBaleen(Boolean hasBaleen) { + this.hasBaleen = hasBaleen; + return this; + } + + /** + * Get hasBaleen + * @return hasBaleen + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_HAS_BALEEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHasBaleen() { + return hasBaleen; + } + + + @JsonProperty(JSON_PROPERTY_HAS_BALEEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHasBaleen(Boolean hasBaleen) { + this.hasBaleen = hasBaleen; + } + + + public Whale hasTeeth(Boolean hasTeeth) { + this.hasTeeth = hasTeeth; + return this; + } + + /** + * Get hasTeeth + * @return hasTeeth + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_HAS_TEETH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHasTeeth() { + return hasTeeth; + } + + + @JsonProperty(JSON_PROPERTY_HAS_TEETH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHasTeeth(Boolean hasTeeth) { + this.hasTeeth = hasTeeth; + } + + + public Whale className(String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(String className) { + this.className = className; + } + + + /** + * Return true if this whale object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Whale whale = (Whale) o; + return Objects.equals(this.hasBaleen, whale.hasBaleen) && + Objects.equals(this.hasTeeth, whale.hasTeeth) && + Objects.equals(this.className, whale.className); + } + + @Override + public int hashCode() { + return Objects.hash(hasBaleen, hasTeeth, className); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Whale {\n"); + sb.append(" hasBaleen: ").append(toIndentedString(hasBaleen)).append("\n"); + sb.append(" hasTeeth: ").append(toIndentedString(hasTeeth)).append("\n"); + sb.append(" className: ").append(toIndentedString(className)).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/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Zebra.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Zebra.java new file mode 100644 index 000000000000..c46c5e2c311d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Zebra.java @@ -0,0 +1,225 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Zebra + */ +@JsonPropertyOrder({ + Zebra.JSON_PROPERTY_TYPE, + Zebra.JSON_PROPERTY_CLASS_NAME +}) +@JsonTypeName("zebra") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Zebra { + /** + * Gets or Sets type + */ + public enum TypeEnum { + PLAINS("plains"), + + MOUNTAIN("mountain"), + + GREVYS("grevys"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @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 + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + private String className; + + public Zebra() { + } + + public Zebra type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + } + + + public Zebra className(String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @jakarta.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(String className) { + this.className = className; + } + + /** + * 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. + */ + @JsonAnySetter + public Zebra 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. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this zebra object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Zebra zebra = (Zebra) o; + return Objects.equals(this.type, zebra.type) && + Objects.equals(this.className, zebra.className)&& + Objects.equals(this.additionalProperties, zebra.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, className, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Zebra {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" className: ").append(toIndentedString(className)).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 "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/ApiClientTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/ApiClientTest.java new file mode 100644 index 000000000000..d83de070118e --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/ApiClientTest.java @@ -0,0 +1,126 @@ +package org.openapitools.client; + +import org.openapitools.client.auth.Authentication; +import org.openapitools.client.auth.HttpSignatureAuth; +import org.openapitools.client.model.*; +import org.openapitools.client.ApiClient; + +import java.lang.Exception; +import java.security.spec.AlgorithmParameterSpec; +import java.util.*; +import java.net.URI; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; + +import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; +import org.tomitribe.auth.signatures.Algorithm; +import org.tomitribe.auth.signatures.Signer; +import org.tomitribe.auth.signatures.SigningAlgorithm; +import java.security.spec.PSSParameterSpec; +import java.security.spec.MGF1ParameterSpec; +import org.tomitribe.auth.signatures.*; +import java.io.ByteArrayInputStream; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.NoSuchAlgorithmException; +import java.security.PublicKey; +import java.security.PrivateKey; + +import org.junit.jupiter.api.*; +import static org.junit.jupiter.api.Assertions.*; + +public class ApiClientTest { + ApiClient apiClient = null; + Pet pet = null; + PrivateKey privateKey = null; + PublicKey publicKey = null; + + @BeforeEach + public void setup() { + apiClient = new ApiClient(); + pet = new Pet(); + try { + KeyPair keypair = KeyPairGenerator.getInstance("RSA").generateKeyPair(); + privateKey = keypair.getPrivate(); + publicKey = keypair.getPublic(); + } catch(NoSuchAlgorithmException e) { + fail("No such algorithm: " + e.toString()); + } + } + + @Test + public void testClientConfig() { + ApiClient testClient = new ApiClient(); + ClientConfig config = testClient.getDefaultClientConfig(); + config.connectorProvider(new ApacheConnectorProvider()); + config.property(ClientProperties.PROXY_URI, "http://localhost:8080"); + config.property(ClientProperties.PROXY_USERNAME,"proxy_user"); + config.property(ClientProperties.PROXY_PASSWORD,"proxy_password"); + testClient.setClientConfig(config); + } + + @Test + public void testUpdateParamsForAuth() throws Exception { + Map headerParams = new HashMap(); + List queryParams = new ArrayList<>(); + + URI uri = new URI("/api/v1/telemetry/TimeSeries"); + + // auth name + String[] authNames = {"http_signature_test"}; + + HashMap authMap = new HashMap(); + + HttpSignatureAuth signatureAuth = new HttpSignatureAuth("some-key-1", SigningAlgorithm.HS2019, Algorithm.RSA_SHA512, null, + null, Arrays.asList(new String[] { "(request-target)" }), 128L); + + signatureAuth.setPrivateKey(privateKey); + + authMap.put("http_signature_test", signatureAuth); + + ApiClient client = new ApiClient(authMap); + + client.updateParamsForAuth(authNames, queryParams, headerParams, null, null, "post", uri); + Signature requestSignature = Signature.fromString(headerParams.get("Authorization"), Algorithm.RSA_SHA512); + Verifier verify = new Verifier(publicKey, requestSignature); + assert verify.verify("post", uri.toString(), headerParams); + } + + @Test + public void testSerializeToString() throws Exception { + Long petId = 4321L; + pet.setId(petId); + pet.setName("jersey2 java8 pet"); + Category category = new Category(); + category.setId(petId); + category.setName("jersey2 java8 category"); + pet.setCategory(category); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + pet.setPhotoUrls(Arrays.asList("A", "B", "C")); + org.openapitools.client.model.Tag tag = new org.openapitools.client.model.Tag(); + tag.setId(petId); + tag.setName("jersey2 java8 tag"); + pet.setTags(Arrays.asList(tag)); + + String result = "{\"id\":4321,\"category\":{\"id\":4321,\"name\":\"jersey2 java8 category\"},\"name\":\"jersey2 java8 pet\",\"photoUrls\":[\"A\",\"B\",\"C\"],\"tags\":[{\"id\":4321,\"name\":\"jersey2 java8 tag\"}],\"status\":\"available\"}"; + assertEquals(result, apiClient.serializeToString(pet, null, "application/json", false)); + // nulllable and there should be no diffencne as the payload is not null + assertEquals(result, apiClient.serializeToString(pet, null, "application/json", true)); + + // non-nullable null object should be converted to "" (empty body) + assertEquals("", apiClient.serializeToString(null, null, "application/json", false)); + // nullable null object should be converted to "null" + assertEquals("null", apiClient.serializeToString(null, null, "application/json", true)); + + // non-nullable empty string should be converted to "\"\"" (empty json string) + assertEquals("\"\"", apiClient.serializeToString("", null, "application/json", false)); + // nullable empty string should be converted to "\"\"" (empty json string) + assertEquals("\"\"", apiClient.serializeToString("", null, "application/json", true)); + + // non-nullable string "null" should be converted to "\"null\"" + assertEquals("\"null\"", apiClient.serializeToString("null", null, "application/json", false)); + // nullable string "null" should be converted to "\"null\"" + assertEquals("\"null\"", apiClient.serializeToString("null", null, "application/json", true)); + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/JSONComposedSchemaTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/JSONComposedSchemaTest.java new file mode 100644 index 000000000000..1834c34b0685 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/JSONComposedSchemaTest.java @@ -0,0 +1,451 @@ +package org.openapitools.client; + +import org.openapitools.client.model.*; +import java.lang.Exception; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.databind.JsonMappingException; + +import org.junit.jupiter.api.*; +import static org.junit.jupiter.api.Assertions.*; + +public class JSONComposedSchemaTest { + JSON json = null; + + @BeforeEach + public void setup() { + json = new JSON(); + } + + @Test + public void testOneOfSchemaAdditionalProperties() throws Exception { + { + // The discriminator value is zebra but the properties belong to Whale. + // The 'whale' properties are considered to be additional (undeclared) properties + // because in the 'zebra' schema, the 'additionalProperties' keyword has been set + // to true. + // TODO: The outcome should depend on the value of the 'useOneOfDiscriminatorLookup' CLI. + String str = "{ \"className\": \"zebra\", \"hasBaleen\": true, \"hasTeeth\": false }"; + AbstractOpenApiSchema o = json.getContext(null).readValue(str, Mammal.class); + assertNotNull(o); + assertTrue(o.getActualInstance() instanceof Zebra); + Zebra z = (Zebra)o.getActualInstance(); + assertNotNull(z.getAdditionalProperties()); + assertEquals(2, z.getAdditionalProperties().size()); + assertTrue(z.getAdditionalProperties().containsKey("hasBaleen")); + } + { + // Same test as above, but this time deserializing directly into the Zebra class. + String str = "{ \"className\": \"zebra\", \"hasBaleen\": true, \"hasTeeth\": false }"; + Zebra o = json.getContext(null).readValue(str, Zebra.class); + assertNotNull(o); + assertNotNull(o.getAdditionalProperties()); + assertEquals(2, o.getAdditionalProperties().size()); + } + { + // Same test as above, but with properties that belong neither to zebra nor whale + String str = "{ \"className\": \"zebra\", \"some_other_property\": \"abc\" }"; + AbstractOpenApiSchema o = json.getContext(null).readValue(str, Mammal.class); + assertNotNull(o); + assertTrue(o.getActualInstance() instanceof Zebra); + Zebra z = (Zebra)o.getActualInstance(); + assertNotNull(z.getAdditionalProperties()); + assertEquals(1, z.getAdditionalProperties().size()); + } + { + // Same test as above, but with properties that belong neither to zebra nor whale + // Deserialize directly into Zebra. + String str = "{ \"className\": \"zebra\", \"some_other_property\": \"abc\" }"; + Zebra o = json.getContext(null).readValue(str, Zebra.class); + assertNotNull(o); + assertNotNull(o.getAdditionalProperties()); + assertEquals(1, o.getAdditionalProperties().size()); + assertTrue(o.getAdditionalProperties().containsKey("some_other_property")); + assertTrue(o.getAdditionalProperties().containsValue("abc")); + } + } + + /** + * Test to ensure the setter will throw IllegalArgumentException + */ + @Test + public void testEnumDiscriminator() throws Exception { + IllegalArgumentException thrown = Assertions.assertThrows(IllegalArgumentException.class, () -> { + ChildCat cc = new ChildCat(); + cc.setPetType("ChildCat"); + assertEquals("ChildCat", cc.getPetType()); + cc.setPetType("WrongValue"); + }); + Assertions.assertEquals("WrongValue is invalid. Possible values for petType: ChildCat", thrown.getMessage()); + } + + /** + * Test to ensure the getter will throw ClassCastException + */ + @Test + public void testCastException() throws Exception { + ClassCastException thrown = Assertions.assertThrows(ClassCastException.class, () -> { + String str = "{ \"cultivar\": \"golden delicious\", \"mealy\": false }"; + FruitReq o = json.getContext(null).readValue(str, FruitReq.class); + assertTrue(o.getActualInstance() instanceof AppleReq); + BananaReq inst2 = o.getBananaReq(); // should throw ClassCastException + }); + // comment out below as the erorr message can be different due to JDK versions + // org.opentest4j.AssertionFailedError: expected: but was: + //Assertions.assertEquals("class org.openapitools.client.model.AppleReq cannot be cast to class org.openapitools.client.model.BananaReq (org.openapitools.client.model.AppleReq and org.openapitools.client.model.BananaReq are in unnamed module of loader 'app')", thrown.getMessage()); + Assertions.assertNotNull(thrown); + } + + /** + * Validate a oneOf schema can be deserialized into the expected class. + * The oneOf schema does not have a discriminator. + */ + @Test + public void testOneOfSchemaWithoutDiscriminator() throws Exception { + // BananaReq and AppleReq have explicitly defined properties that are different by name. + // There is no discriminator property. + { + String str = "{ \"cultivar\": \"golden delicious\", \"mealy\": false }"; + FruitReq o = json.getContext(null).readValue(str, FruitReq.class); + assertTrue(o.getActualInstance() instanceof AppleReq); + AppleReq inst = (AppleReq) o.getActualInstance(); + assertEquals(inst.getCultivar(), "golden delicious"); + assertEquals(inst.getMealy(), false); + + AppleReq inst2 = o.getAppleReq(); + assertEquals(inst2.getCultivar(), "golden delicious"); + assertEquals(inst2.getMealy(), false); + } + { + // Same test, but this time with additional (undeclared) properties. + // Since FruitReq has additionalProperties: false, deserialization should fail. + String str = "{ \"cultivar\": \"golden delicious\", \"mealy\": false, \"garbage_prop\": \"abc\" }"; + Exception exception = assertThrows(JsonMappingException.class, () -> { + FruitReq o = json.getContext(null).readValue(str, FruitReq.class); + }); + assertTrue(exception.getMessage().contains("Failed deserialization for FruitReq: 0 classes match result")); + } + { + String str = "{ \"lengthCm\": 17 }"; + FruitReq o = json.getContext(null).readValue(str, FruitReq.class); + assertTrue(o.getActualInstance() instanceof BananaReq); + BananaReq inst = (BananaReq) o.getActualInstance(); + assertEquals(inst.getLengthCm(), new java.math.BigDecimal(17)); + } + { + // Try to deserialize empty object. This should fail 'oneOf' because that will match + // both AppleReq and BananaReq. + String str = "{ }"; + Exception exception = assertThrows(JsonMappingException.class, () -> { + json.getContext(null).readValue(str, FruitReq.class); + }); + assertTrue(exception.getMessage().contains("Failed deserialization for FruitReq: 2 classes match result")); + // TODO: add a similar unit test where the oneOf child schemas have required properties. + // If the implementation is correct, the unmarshaling should take the "required" keyword + // into consideration, which it is not doing currently. + } + { + // Deserialize the null value. This should be allowed because the 'FruitReq' schema + // has nullable: true. + String str = "null"; + FruitReq o = json.getContext(null).readValue(str, FruitReq.class); + assertNull(o); + } + } + + /** + * Validate a oneOf schema can be deserialized into the expected class. + * The oneOf schema has a discriminator. + */ + @Test + public void testOneOfSchemaWithDiscriminator() throws Exception { + // Mammal can be one of whale, pig and zebra. + // pig has sub-classes. + { + String str = "{ \"className\": \"whale\", \"hasBaleen\": true, \"hasTeeth\": false }"; + + // Note that the 'zebra' schema does not have any explicit property defined AND + // it has additionalProperties: true. Hence without a discriminator the above + // JSON payload would match both 'whale' and 'zebra'. This is because the 'hasBaleen' + // and 'hasTeeth' would be considered additional (undeclared) properties for 'zebra'. + AbstractOpenApiSchema o = json.getContext(null).readValue(str, Mammal.class); + assertNotNull(o); + assertTrue(o.getActualInstance() instanceof Whale); + } + { + String str = "{ \"className\": \"zebra\", \"type\": \"plains\" }"; + AbstractOpenApiSchema o = json.getContext(null).readValue(str, Mammal.class); + assertNotNull(o); + assertTrue(o.getActualInstance() instanceof Zebra); + Zebra z = (Zebra)o.getActualInstance(); + assertEquals(Zebra.TypeEnum.PLAINS, z.getType()); + } + { + // The discriminator value is valid but the 'type' value is invalid. + String str = "{ \"className\": \"zebra\", \"type\": \"garbage_value\" }"; + Exception exception = assertThrows(JsonMappingException.class, () -> { + json.getContext(null).readValue(str, Mammal.class); + }); + } + { + String str = "{ \"className\": \"zebra\" }"; + AbstractOpenApiSchema o = json.getContext(null).readValue(str, Mammal.class); + assertNotNull(o); + assertTrue(o.getActualInstance() instanceof Zebra); + Zebra z = (Zebra)o.getActualInstance(); + assertNull(z.getAdditionalProperties()); + } + { + /* comment out while unboxing nested oneOf/anyOf is still in discussion + // Deserialization test with indirections of 'oneOf' child schemas. + // Mammal is oneOf whale, zebra and pig, and pig is itself one of BasquePig, DanishPig. + String str = "{ \"className\": \"BasquePig\" }"; + AbstractOpenApiSchema o = json.getContext(null).readValue(str, Mammal.class); + assertTrue(o.getActualInstance() instanceof BasquePig); + */ + } + } + + @Test + public void testOneOfNullable() throws Exception { + String str = "null"; + // 'null' is a valid value for NullableShape because it is nullable. + AbstractOpenApiSchema o = json.getContext(null).readValue(str, NullableShape.class); + assertNull(o); + + // 'null' is a valid value for ShapeOrNull because it is a oneOf with one of the + // children being the null type. + o = json.getContext(null).readValue(str, ShapeOrNull.class); + assertNull(o); + + // 'null' is not a valid value for the Shape model because it is not nullable. + // An exception should be raised. + Exception exception = assertThrows(JsonMappingException.class, () -> { + json.getContext(null).readValue(str, Shape.class); + }); + assertTrue(exception.getMessage().contains("Shape cannot be null")); + } + + /** + * Test payload with more than one discriminator. + */ + @Test + public void testOneOfMultipleDiscriminators() throws Exception { + // 'shapeType' is a discriminator for the 'Shape' model and + // 'triangleType' is a discriminator forr the 'Triangle' model. + String str = "{ \"shapeType\": \"Triangle\", \"triangleType\": \"EquilateralTriangle\" }"; + + // We should be able to deserialize a equilateral triangle into a EquilateralTriangle class. + EquilateralTriangle t = json.getContext(null).readValue(str, EquilateralTriangle.class); + assertNotNull(t); + + // We should be able to deserialize a equilateral triangle into a triangle. + AbstractOpenApiSchema o = json.getContext(null).readValue(str, Triangle.class); + assertNotNull(o); + assertTrue(o.getActualInstance() instanceof EquilateralTriangle); + + // We should be able to deserialize a equilateral triangle into a shape. + o = json.getContext(null).readValue(str, Shape.class); + // The container is a shape, and the actual instance should be a EquilateralTriangle. + assertTrue(o instanceof Shape); + /* comment out while unboxing nested oneOf/anyOf is still in discussion + assertTrue(o.getActualInstance() instanceof EquilateralTriangle); + + // It is not valid to deserialize a equilateral triangle into a quadrilateral. + Exception exception = assertThrows(JsonMappingException.class, () -> { + json.getContext(null).readValue(str, Quadrilateral.class); + }); + assertTrue(exception.getMessage().contains("Failed deserialization for Quadrilateral: 0 classes match result")); + */ + } + + @Test + public void testOneOfNestedComposedSchema() throws Exception { + { + String str = "{ " + + " \"mainShape\": { \"shapeType\": \"Triangle\", \"triangleType\": \"EquilateralTriangle\" }, " + + " \"shapeOrNull\": { \"shapeType\": \"Quadrilateral\", \"quadrilateralType\": \"SimpleQuadrilateral\" }, " + + " \"nullableShape\": { \"shapeType\": \"Triangle\", \"triangleType\": \"ScaleneTriangle\" } " + + "}"; + Drawing d = json.getContext(null).readValue(str, Drawing.class); + assertNotNull(d); + assertNotNull(d.getMainShape()); + assertNotNull(d.getShapeOrNull()); + assertNotNull(d.getNullableShape()); + assertTrue(d.getMainShape().getActualInstance() instanceof Triangle); + assertTrue(d.getShapeOrNull().getActualInstance() instanceof Quadrilateral); + assertTrue(d.getNullableShape().getActualInstance() instanceof Triangle); + // TODO: add assertions with call to getActualInstanceRecursively(). + //assertTrue(d.getMainShape().getActualInstanceRecursively() instanceof EquilateralTriangle); + //assertTrue(d.getShapeOrNull().getActualInstanceRecursively() instanceof SimpleQuadrilateral); + //assertTrue(d.getNullableShape().getActualInstanceRecursively() instanceof ScaleneTriangle); + } + + { + String str = "{ " + + " \"mainShape\": { \"shapeType\": \"Triangle\", \"triangleType\": \"EquilateralTriangle\" }, " + + " \"shapeOrNull\": null, " + + " \"nullableShape\": null " + + "}"; + Drawing d = json.getContext(null).readValue(str, Drawing.class); + assertNotNull(d); + assertNotNull(d.getMainShape()); + assertNull(d.getShapeOrNull()); + assertNull(d.getNullableShape()); + assertTrue(d.getMainShape().getActualInstance() instanceof Triangle); + } + } + + @Test + public void testOneOfNestedComposedSchemaWithAdditionalProperties() throws Exception { + { + String str = "{ " + + " \"mainShape\": { \"shapeType\": \"Triangle\", \"triangleType\": \"EquilateralTriangle\" }, " + + " \"shapeOrNull\": { \"shapeType\": \"Quadrilateral\", \"quadrilateralType\": \"SimpleQuadrilateral\" }, " + + " \"nullableShape\": { \"shapeType\": \"Triangle\", \"triangleType\": \"ScaleneTriangle\" }, " + + " \"fruit_1\": { \"cultivar\": \"golden delicious\", \"origin\": \"California\" }," + + " \"fruit_2\": { \"cultivar\": \"honeycrisp\", \"origin\": \"California\" }" + + "}"; + Drawing d = json.getContext(null).readValue(str, Drawing.class); + assertNotNull(d); + assertNotNull(d.getMainShape()); + assertNotNull(d.getShapeOrNull()); + assertNotNull(d.getNullableShape()); + assertTrue(d.getMainShape().getActualInstance() instanceof Triangle); + assertTrue(d.getShapeOrNull().getActualInstance() instanceof Quadrilateral); + assertTrue(d.getNullableShape().getActualInstance() instanceof Triangle); + // TODO: add assertions with call to getActualInstanceRecursively(). + //assertTrue(d.getMainShape().getActualInstanceRecursively() instanceof EquilateralTriangle); + //assertTrue(d.getShapeOrNull().getActualInstanceRecursively() instanceof SimpleQuadrilateral); + //assertTrue(d.getNullableShape().getActualInstanceRecursively() instanceof ScaleneTriangle); + assertNotNull(d.getAdditionalProperties()); + assertEquals(2, d.getAdditionalProperties().size()); + assertTrue(d.getAdditionalProperties().containsKey("fruit_1")); + assertTrue(d.getAdditionalProperties().containsKey("fruit_2")); + Fruit f1 = d.getAdditionalProperties().get("fruit_1"); + assertTrue(f1.getActualInstance() instanceof Apple); + Apple a = (Apple)f1.getActualInstance(); + assertEquals("golden delicious", a.getCultivar()); + assertEquals("California", a.getOrigin()); + } + } + + /** + * Validate a allOf schema can be deserialized into the expected class. + */ + @Test + public void testAllOfSchema() throws Exception { + { + String str = "{ \"className\": \"Dog\", \"color\": \"white\", \"breed\": \"Siberian Husky\" }"; + + // We should be able to deserialize a dog into a Dog. + Dog d = json.getContext(null).readValue(str, Dog.class); + assertNotNull(d); + assertEquals("white", d.getColor()); + } + { + String str = "{ \"pet_type\": \"ChildCat\", \"name\": \"fluffy\", " + + " \"stuff1\": \"the_value\", " + // additional, undeclared property of type string. + " \"stuff2\": { \"p1\": 123 }, " + // additional, undeclared property of type object. + " \"stuff3\": null," + // additional, undeclared property with null value. + " \"stuff4\": [ 12, \"abc\" ]" + // additional, undeclared property of type array. + " }"; + GrandparentAnimal o = json.getContext(null).readValue(str, GrandparentAnimal.class); + assertNotNull(o); + assertTrue(o instanceof ParentPet); + assertTrue(o instanceof ChildCat); + ChildCat c = (ChildCat)o; + assertEquals("fluffy", c.getName()); + assertNotNull(c.getAdditionalProperties()); + assertEquals(4, c.getAdditionalProperties().size()); + assertTrue(c.getAdditionalProperties().containsKey("stuff1")); + assertTrue(c.getAdditionalProperties().containsKey("stuff2")); + assertTrue(c.getAdditionalProperties().containsKey("stuff3")); + assertTrue(c.getAdditionalProperties().containsKey("stuff4")); + assertEquals("the_value", c.getAdditionalProperties().get("stuff1")); + assertNotNull(c.getAdditionalProperties().get("stuff2")); + assertTrue(c.getAdditionalProperties().get("stuff2") instanceof Map); + assertNull(c.getAdditionalProperties().get("stuff3")); + assertNotNull(c.getAdditionalProperties().get("stuff4")); + assertTrue(c.getAdditionalProperties().get("stuff4") instanceof List); + } + { + String str = "{ \"pet_type\": \"ChildCat\", \"name\": \"fluffy\" }"; + ParentPet o = json.getContext(null).readValue(str, ParentPet.class); + assertNotNull(o); + assertTrue(o instanceof ChildCat); + ChildCat c = (ChildCat)o; + assertEquals("fluffy", c.getName()); + } + { + // Wrong discriminator value in the payload. + String str = "{ \"pet_type\": \"Garbage\", \"name\": \"fluffy\" }"; + Exception exception = assertThrows(JsonMappingException.class, () -> { + json.getContext(null).readValue(str, GrandparentAnimal.class); + }); + assertTrue(exception.getMessage().contains("Could not resolve type id 'Garbage'")); + } + } + + @Test + public void testNullValueDisallowed() throws Exception { + { + String str = "{ \"id\": 123, \"petId\": 345, \"quantity\": 100, \"status\": \"placed\" }"; + org.openapitools.client.model.Order o = json.getContext(null).readValue(str, org.openapitools.client.model.Order.class); + assertEquals(100L, (long)o.getQuantity()); + assertEquals(org.openapitools.client.model.Order.StatusEnum.PLACED, o.getStatus()); + } + { + String str = "{ \"id\": 123, \"petId\": 345, \"quantity\": null }"; + org.openapitools.client.model.Order o = json.getContext(null).readValue(str, org.openapitools.client.model.Order.class); + // TODO: the null value is not allowed per OAS document. + // The deserialization should fail. + assertNull(o.getQuantity()); + } + } + + /** + * Validate a anyOf schema can be deserialized into the expected class. + * The anyOf schema has a discriminator. + */ + @Test + public void testAnyOfSchemaWithoutDiscriminator() throws Exception { + { + // TODO: the GmFruit defines a 'color' property, which should be allowed + // in the input data, but the generated code does not have it. + String str = "{ \"cultivar\": \"golden delicious\", \"origin\": \"California\" }"; + GmFruit o = json.getContext(null).readValue(str, GmFruit.class); + assertTrue(o.getActualInstance() instanceof Apple); + Apple inst = (Apple) o.getActualInstance(); + assertEquals("golden delicious", inst.getCultivar()); + assertEquals("California", inst.getOrigin()); + // TODO: the 'Color' property is not generated for the 'GmFruit'. + //assertEquals("yellow", o.getColor()); + } + { + String str = "{ \"lengthCm\": 17 }"; + GmFruit o = json.getContext(null).readValue(str, GmFruit.class); + assertTrue(o.getActualInstance() instanceof Banana); + Banana inst = (Banana) o.getActualInstance(); + assertEquals(new java.math.BigDecimal(17), inst.getLengthCm()); + } + { + // Deserialize empty object. This should work because it will match either apple or banana. + String str = "{ }"; + GmFruit o = json.getContext(null).readValue(str, GmFruit.class); + // The payload matches against either apple or banana, so either model could be returned, + // but the implementation always picks the first anyOf child schema that matches the + // input payload. + assertTrue(o.getActualInstance() instanceof Apple); + } + { + // Deserialize the null value. This is not allowed because the 'gmFruit' schema + // is not nullable. + String str = "null"; + Exception exception = assertThrows(JsonMappingException.class, () -> { + GmFruit o = json.getContext(null).readValue(str, GmFruit.class); + }); + assertTrue(exception.getMessage().contains("GmFruit cannot be null")); + } + } +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/JSONTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/JSONTest.java new file mode 100644 index 000000000000..b5e9d7872a0e --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/JSONTest.java @@ -0,0 +1,90 @@ +package org.openapitools.client; + +import org.openapitools.client.model.Order; +import org.openapitools.client.model.SpecialModelName; + +import java.lang.Exception; +import java.util.Date; +import java.util.TimeZone; +import java.text.SimpleDateFormat; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; + +import org.junit.jupiter.api.*; +import static org.junit.jupiter.api.Assertions.*; + +public class JSONTest { + JSON json = null; + Order order = null; + + @BeforeEach + public void setup() { + json = new JSON(); + order = new Order(); + } + + @Test + public void testDefaultDate() throws Exception { + final DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME; + final String dateStr = "2015-11-07T14:11:05.267Z"; + order.setShipDate(dateFormat.parse(dateStr, OffsetDateTime::from)); + + String str = json.getContext(null).writeValueAsString(order); + Order o = json.getContext(null).readValue(str, Order.class); + assertEquals(dateStr, dateFormat.format(o.getShipDate())); + } + + @Test + public void testRFC3339DateFormatDate() throws Exception { + { + String dateStr = "2011-01-18 00:00:00.0Z"; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S'Z'"); + sdf.setTimeZone(TimeZone.getTimeZone("GMT")); + Date date = sdf.parse(dateStr); + + RFC3339DateFormat df = new RFC3339DateFormat(); + StringBuffer sb = new StringBuffer(); + String s = df.format(date); + System.out.println("DATE: " + s); + assertEquals("2011-01-18T00:00:00.000+00:00", s); + } + { + String dateStr = "2011-01-18 00:00:00.0"; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); + sdf.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles")); + Date date = sdf.parse(dateStr); + + RFC3339DateFormat df = new RFC3339DateFormat(); + StringBuffer sb = new StringBuffer(); + String s = df.format(date); + assertEquals("2011-01-18T08:00:00.000+00:00", s); + } + } + + @Test + public void testCustomDate() throws Exception { + final DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(ZoneId.of("Etc/GMT+2")); + final String dateStr = "2015-11-07T14:11:05-02:00"; + order.setShipDate(dateFormat.parse(dateStr, OffsetDateTime::from)); + + String str = json.getContext(null).writeValueAsString(order); + Order o = json.getContext(null).readValue(str, Order.class); + assertEquals(dateStr, dateFormat.format(o.getShipDate())); + } + + /** + * Validate a schema with special characters can be deserialized. + */ + @Test + public void testSchemaWithSpecialCharacters() throws Exception { + String str = "{ \"$special[property.name]\": 12345 }"; + // The name of the OpenAPI schema is '_special_model.name_'. + // After sanitization rules are applied the name of the class is 'SpecialModelName'. + // The class deserialization should be successful because + // of the @JsonSubTypes annotation. + SpecialModelName o = json.getContext(null).readValue(str, SpecialModelName.class); + assertNotNull(o); + assertEquals((long)12345, (long)o.get$SpecialPropertyName()); + } +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java new file mode 100644 index 000000000000..746794d96876 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.*; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.Client; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AnotherFakeApi + */ +public class AnotherFakeApiTest { + + private final AnotherFakeApi api = new AnotherFakeApi(); + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + * + * @throws ApiException if the Api call fails + */ + @Test + public void call123testSpecialTagsTest() throws ApiException { + //Client client = null; + //Client response = api.call123testSpecialTags(client); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/DefaultApiTest.java new file mode 100644 index 000000000000..248dbfc04553 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -0,0 +1,45 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.*; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.InlineResponseDefault; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for DefaultApi + */ +public class DefaultApiTest { + + private final DefaultApi api = new DefaultApi(); + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fooGetTest() throws ApiException { + //InlineResponseDefault response = api.fooGet(); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 000000000000..99ec8629a504 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,271 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.*; +import org.openapitools.client.auth.*; +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.User; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +public class FakeApiTest { + + private final FakeApi api = new FakeApi(); + + /** + * Health check endpoint + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeHealthGetTest() throws ApiException { + //HealthCheckResult response = api.fakeHealthGet(); + // TODO: test validations + } + + /** + * Test serialization of outer boolean types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterBooleanSerializeTest() throws ApiException { + //Boolean body = null; + //Boolean response = api.fakeOuterBooleanSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of object with outer number type + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterCompositeSerializeTest() throws ApiException { + //OuterComposite outerComposite = null; + //OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite); + // TODO: test validations + } + + /** + * Test serialization of outer number types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterNumberSerializeTest() throws ApiException { + //BigDecimal body = null; + //BigDecimal response = api.fakeOuterNumberSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of outer string types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterStringSerializeTest() throws ApiException { + //String body = null; + //String response = api.fakeOuterStringSerialize(body); + // TODO: test validations + } + + /** + * Array of Enums + * + * @throws ApiException if the Api call fails + */ + @Test + public void getArrayOfEnumsTest() throws ApiException { + //List response = api.getArrayOfEnums(); + // TODO: test validations + } + + /** + * For this test, the body for this request much reference a schema named `File`. + * + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithFileSchemaTest() throws ApiException { + //FileSchemaTestClass fileSchemaTestClass = null; + //api.testBodyWithFileSchema(fileSchemaTestClass); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithQueryParamsTest() throws ApiException { + //String query = null; + //User user = null; + //api.testBodyWithQueryParams(query, user); + // TODO: test validations + } + + /** + * To test \"client\" model + * + * To test \"client\" model + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClientModelTest() throws ApiException { + //Client client = null; + //Client response = api.testClientModel(client); + // TODO: test validations + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEndpointParametersTest() throws ApiException { + //BigDecimal number = null; + //Double _double = null; + //String patternWithoutDelimiter = null; + //byte[] _byte = null; + //Integer integer = null; + //Integer int32 = null; + //Long int64 = null; + //Float _float = null; + //String string = null; + //File binary = null; + //LocalDate date = null; + //OffsetDateTime dateTime = null; + //String password = null; + //String paramCallback = null; + //api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + // TODO: test validations + } + + /** + * To test enum parameters + * + * To test enum parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEnumParametersTest() throws ApiException { + //List enumHeaderStringArray = null; + //String enumHeaderString = null; + //List enumQueryStringArray = null; + //String enumQueryString = null; + //Integer enumQueryInteger = null; + //Double enumQueryDouble = null; + //List enumFormStringArray = null; + //String enumFormString = null; + //api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + // TODO: test validations + } + + /** + * Fake endpoint to test group parameters (optional) + * + * Fake endpoint to test group parameters (optional) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testGroupParametersTest() throws ApiException { + //Integer requiredStringGroup = null; + //Boolean requiredBooleanGroup = null; + //Long requiredInt64Group = null; + //Integer stringGroup = null; + //Boolean booleanGroup = null; + //Long int64Group = null; + //api.testGroupParameters() + // .requiredStringGroup(requiredStringGroup) + // .requiredBooleanGroup(requiredBooleanGroup) + // .requiredInt64Group(requiredInt64Group) + // .stringGroup(stringGroup) + // .booleanGroup(booleanGroup) + // .int64Group(int64Group) + // .execute(); + // TODO: test validations + } + + /** + * test inline additionalProperties + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testInlineAdditionalPropertiesTest() throws ApiException { + //Map requestBody = null; + //api.testInlineAdditionalProperties(requestBody); + // TODO: test validations + } + + /** + * test json serialization of form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testJsonFormDataTest() throws ApiException { + //String param = null; + //String param2 = null; + //api.testJsonFormData(param, param2); + // TODO: test validations + } + + /** + * To test the collection format in query parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryParameterCollectionFormatTest() throws ApiException { + //List pipe = null; + //List ioutil = null; + //List http = null; + //List url = null; + //List context = null; + //api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 000000000000..92a40d23900a --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.*; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.Client; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + /** + * To test class name in snake case + * + * To test class name in snake case + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + //Client client = null; + //Client response = api.testClassname(client); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..9c61bba29e36 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,224 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.*; +import org.openapitools.client.auth.*; +import java.io.File; +import org.openapitools.client.model.*; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; + +/** + * API tests for PetApi + */ +public class PetApiTest { + + private final PetApi api = new PetApi(); + private final long petId = 5638l; + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + // add pet + Pet body = new Pet(); + body.setId(petId); + body.setName("jersey2 java8 pet"); + Category category = new Category(); + category.setId(petId); + category.setName("jersey2 java8 category"); + body.setCategory(category); + body.setStatus(Pet.StatusEnum.AVAILABLE); + body.setPhotoUrls(Arrays.asList("A", "B", "C")); + Tag tag = new Tag(); + tag.setId(petId); + tag.setName("jersey2 java8 tag"); + body.setTags(Arrays.asList(tag)); + + api.addPet(body); + + //get pet by ID + Pet result = api.getPetById(petId); + Assertions.assertEquals(result.getId(), body.getId()); + Assertions.assertEquals(result.getCategory(), category); + Assertions.assertEquals(result.getName(), body.getName()); + Assertions.assertEquals(result.getPhotoUrls(), body.getPhotoUrls()); + Assertions.assertEquals(result.getStatus(), body.getStatus()); + Assertions.assertEquals(result.getTags(), body.getTags()); + + // update pet + api.updatePetWithForm(petId, "jersey2 java8 pet 2", "sold"); + + //get pet by ID + Pet result2 = api.getPetById(petId); + Assertions.assertEquals(result2.getId(), body.getId()); + Assertions.assertEquals(result2.getCategory(), category); + Assertions.assertEquals(result2.getName(), "jersey2 java8 pet 2"); + Assertions.assertEquals(result2.getPhotoUrls(), body.getPhotoUrls()); + Assertions.assertEquals(result2.getStatus(), Pet.StatusEnum.SOLD); + Assertions.assertEquals(result2.getTags(), body.getTags()); + + // delete pet + api.deletePet(petId, "empty api key"); + + try { + Pet result3 = api.getPetById(petId); + Assertions.assertEquals(false, true); + } 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()); + + Assertions.assertEquals(e.getCode(), 404); + Assertions.assertEquals(e.getResponseBody(), "{\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}"); + + } + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + //Long petId = null; + //String apiKey = null; + //api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * 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() throws ApiException { + //List status = null; + //List response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * 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() throws ApiException { + //List tags = null; + //List response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + //Long petId = null; + //Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + //Pet pet = null; + //api.updatePet(pet); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + //Long petId = null; + //String name = null; + //String status = null; + //api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + //Long petId = null; + //String additionalMetadata = null; + //File _file = null; + //ModelApiResponse response = api.uploadFile(petId, additionalMetadata, _file); + // TODO: test validations + } + + /** + * uploads an image (required) + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileWithRequiredFileTest() throws ApiException { + //Long petId = null; + //File requiredFile = null; + //String additionalMetadata = null; + //ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..38f008c16cdb --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,91 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.*; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.Order; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + /** + * 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() throws ApiException { + //String orderId = null; + //api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + //Map response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + //Long orderId = null; + //Order response = api.getOrderById(orderId); + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + //Order order = null; + //Order response = api.placeOrder(order); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..358763cb9be0 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,150 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.*; +import org.openapitools.client.auth.*; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +public class UserApiTest { + + private final UserApi api = new UserApi(); + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + //User user = null; + //api.createUser(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + //List user = null; + //api.createUsersWithArrayInput(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + //List user = null; + //api.createUsersWithListInput(user); + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + //String username = null; + //api.deleteUser(username); + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + //String username = null; + //User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + //String username = null; + //String password = null; + //String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + //api.logoutUser(); + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + //String username = null; + //User user = null; + //api.updateUser(username, user); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..635c50f435e6 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java @@ -0,0 +1,113 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesClass + */ +public class AdditionalPropertiesClassTest { + private final AdditionalPropertiesClass model = new AdditionalPropertiesClass(); + + /** + * Model tests for AdditionalPropertiesClass + */ + @Test + public void testAdditionalPropertiesClass() { + // TODO: test AdditionalPropertiesClass + } + + /** + * Test the property 'mapProperty' + */ + @Test + public void mapPropertyTest() { + // TODO: test mapProperty + } + + /** + * Test the property 'mapOfMapProperty' + */ + @Test + public void mapOfMapPropertyTest() { + // TODO: test mapOfMapProperty + } + + /** + * Test the property 'anytype1' + */ + @Test + public void anytype1Test() { + // TODO: test anytype1 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype1' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype1Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype1 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype2' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype2Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype2 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype3' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype3Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype3 + } + + /** + * Test the property 'emptyMap' + */ + @Test + public void emptyMapTest() { + // TODO: test emptyMap + } + + /** + * Test the property 'mapWithUndeclaredPropertiesString' + */ + @Test + public void mapWithUndeclaredPropertiesStringTest() { + // TODO: test mapWithUndeclaredPropertiesString + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AnimalTest.java new file mode 100644 index 000000000000..84cc827725b4 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Animal + */ +public class AnimalTest { + private final Animal model = new Animal(); + + /** + * Model tests for Animal + */ + @Test + public void testAnimal() { + // TODO: test Animal + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AppleReqTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AppleReqTest.java new file mode 100644 index 000000000000..436f436eff06 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AppleReqTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AppleReq + */ +public class AppleReqTest { + private final AppleReq model = new AppleReq(); + + /** + * Model tests for AppleReq + */ + @Test + public void testAppleReq() { + // TODO: test AppleReq + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'mealy' + */ + @Test + public void mealyTest() { + // TODO: test mealy + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AppleTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AppleTest.java new file mode 100644 index 000000000000..a0dfa4507a5f --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AppleTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Apple + */ +public class AppleTest { + private final Apple model = new Apple(); + + /** + * Model tests for Apple + */ + @Test + public void testApple() { + // TODO: test Apple + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..843755edbbef --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -0,0 +1,53 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfArrayOfNumberOnly + */ +public class ArrayOfArrayOfNumberOnlyTest { + private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfArrayOfNumberOnly + */ + @Test + public void testArrayOfArrayOfNumberOnly() { + // TODO: test ArrayOfArrayOfNumberOnly + } + + /** + * Test the property 'arrayArrayNumber' + */ + @Test + public void arrayArrayNumberTest() { + // TODO: test arrayArrayNumber + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..7c4c38a6e064 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java @@ -0,0 +1,53 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfNumberOnly + */ +public class ArrayOfNumberOnlyTest { + private final ArrayOfNumberOnly model = new ArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfNumberOnly + */ + @Test + public void testArrayOfNumberOnly() { + // TODO: test ArrayOfNumberOnly + } + + /** + * Test the property 'arrayNumber' + */ + @Test + public void arrayNumberTest() { + // TODO: test arrayNumber + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ArrayTestTest.java new file mode 100644 index 000000000000..58d78aa4a5cd --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ArrayTestTest.java @@ -0,0 +1,69 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayTest + */ +public class ArrayTestTest { + private final ArrayTest model = new ArrayTest(); + + /** + * Model tests for ArrayTest + */ + @Test + public void testArrayTest() { + // TODO: test ArrayTest + } + + /** + * Test the property 'arrayOfString' + */ + @Test + public void arrayOfStringTest() { + // TODO: test arrayOfString + } + + /** + * Test the property 'arrayArrayOfInteger' + */ + @Test + public void arrayArrayOfIntegerTest() { + // TODO: test arrayArrayOfInteger + } + + /** + * Test the property 'arrayArrayOfModel' + */ + @Test + public void arrayArrayOfModelTest() { + // TODO: test arrayArrayOfModel + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/BananaReqTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/BananaReqTest.java new file mode 100644 index 000000000000..675128f9b9d9 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/BananaReqTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BananaReq + */ +public class BananaReqTest { + private final BananaReq model = new BananaReq(); + + /** + * Model tests for BananaReq + */ + @Test + public void testBananaReq() { + // TODO: test BananaReq + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + + /** + * Test the property 'sweet' + */ + @Test + public void sweetTest() { + // TODO: test sweet + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/BananaTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/BananaTest.java new file mode 100644 index 000000000000..60855139ce79 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/BananaTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Banana + */ +public class BananaTest { + private final Banana model = new Banana(); + + /** + * Model tests for Banana + */ + @Test + public void testBanana() { + // TODO: test Banana + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/BasquePigTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/BasquePigTest.java new file mode 100644 index 000000000000..f08be5450b77 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/BasquePigTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BasquePig + */ +public class BasquePigTest { + private final BasquePig model = new BasquePig(); + + /** + * Model tests for BasquePig + */ + @Test + public void testBasquePig() { + // TODO: test BasquePig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/CapitalizationTest.java new file mode 100644 index 000000000000..f36daac40c15 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/CapitalizationTest.java @@ -0,0 +1,90 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Capitalization + */ +public class CapitalizationTest { + private final Capitalization model = new Capitalization(); + + /** + * Model tests for Capitalization + */ + @Test + public void testCapitalization() { + // TODO: test Capitalization + } + + /** + * Test the property 'smallCamel' + */ + @Test + public void smallCamelTest() { + // TODO: test smallCamel + } + + /** + * Test the property 'capitalCamel' + */ + @Test + public void capitalCamelTest() { + // TODO: test capitalCamel + } + + /** + * Test the property 'smallSnake' + */ + @Test + public void smallSnakeTest() { + // TODO: test smallSnake + } + + /** + * Test the property 'capitalSnake' + */ + @Test + public void capitalSnakeTest() { + // TODO: test capitalSnake + } + + /** + * Test the property 'scAETHFlowPoints' + */ + @Test + public void scAETHFlowPointsTest() { + // TODO: test scAETHFlowPoints + } + + /** + * Test the property 'ATT_NAME' + */ + @Test + public void ATT_NAMETest() { + // TODO: test ATT_NAME + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/CatAllOfTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/CatAllOfTest.java new file mode 100644 index 000000000000..a0731738b24d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/CatAllOfTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for CatAllOf + */ +public class CatAllOfTest { + private final CatAllOf model = new CatAllOf(); + + /** + * Model tests for CatAllOf + */ + @Test + public void testCatAllOf() { + // TODO: test CatAllOf + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/CatTest.java new file mode 100644 index 000000000000..43055fd2be03 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/CatTest.java @@ -0,0 +1,71 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Animal; +import org.openapitools.client.model.CatAllOf; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Cat + */ +public class CatTest { + private final Cat model = new Cat(); + + /** + * Model tests for Cat + */ + @Test + public void testCat() { + // TODO: test Cat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..8ad0eee05e0a --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.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/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ChildCatAllOfTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ChildCatAllOfTest.java new file mode 100644 index 000000000000..f2820f8cd35d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ChildCatAllOfTest.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Set; +import java.util.HashSet; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ChildCatAllOf + */ +public class ChildCatAllOfTest { + private final ChildCatAllOf model = new ChildCatAllOf(); + + /** + * Model tests for ChildCatAllOf + */ + @Test + public void testChildCatAllOf() { + // TODO: test ChildCatAllOf + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ChildCatTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ChildCatTest.java new file mode 100644 index 000000000000..82ff19a5d767 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ChildCatTest.java @@ -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. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ChildCatAllOf; +import org.openapitools.client.model.ParentPet; +import java.util.Set; +import java.util.HashSet; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ChildCat + */ +public class ChildCatTest { + private final ChildCat model = new ChildCat(); + + /** + * Model tests for ChildCat + */ + @Test + public void testChildCat() { + // TODO: test ChildCat + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ClassModelTest.java new file mode 100644 index 000000000000..d60c8d4aaabb --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ClassModelTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ClassModel + */ +public class ClassModelTest { + private final ClassModel model = new ClassModel(); + + /** + * Model tests for ClassModel + */ + @Test + public void testClassModel() { + // TODO: test ClassModel + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ClientTest.java new file mode 100644 index 000000000000..f6759ee68279 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ClientTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Client + */ +public class ClientTest { + private final Client model = new Client(); + + /** + * Model tests for Client + */ + @Test + public void testClient() { + // TODO: test Client + } + + /** + * Test the property 'client' + */ + @Test + public void clientTest() { + // TODO: test client + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java new file mode 100644 index 000000000000..685c0829fa1d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.QuadrilateralInterface; +import org.openapitools.client.model.ShapeInterface; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ComplexQuadrilateral + */ +public class ComplexQuadrilateralTest { + private final ComplexQuadrilateral model = new ComplexQuadrilateral(); + + /** + * Model tests for ComplexQuadrilateral + */ + @Test + public void testComplexQuadrilateral() { + // TODO: test ComplexQuadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DanishPigTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DanishPigTest.java new file mode 100644 index 000000000000..2a5ade5f5452 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DanishPigTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DanishPig + */ +public class DanishPigTest { + private final DanishPig model = new DanishPig(); + + /** + * Model tests for DanishPig + */ + @Test + public void testDanishPig() { + // TODO: test DanishPig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java new file mode 100644 index 000000000000..56a80875062c --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DeprecatedObject + */ +public class DeprecatedObjectTest { + private final DeprecatedObject model = new DeprecatedObject(); + + /** + * Model tests for DeprecatedObject + */ + @Test + public void testDeprecatedObject() { + // TODO: test DeprecatedObject + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DogAllOfTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DogAllOfTest.java new file mode 100644 index 000000000000..7e139a4d950e --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DogAllOfTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DogAllOf + */ +public class DogAllOfTest { + private final DogAllOf model = new DogAllOf(); + + /** + * Model tests for DogAllOf + */ + @Test + public void testDogAllOf() { + // TODO: test DogAllOf + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DogTest.java new file mode 100644 index 000000000000..e6f849f7f8c8 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DogTest.java @@ -0,0 +1,71 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Animal; +import org.openapitools.client.model.DogAllOf; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Dog + */ +public class DogTest { + private final Dog model = new Dog(); + + /** + * Model tests for Dog + */ + @Test + public void testDog() { + // TODO: test Dog + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DrawingTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DrawingTest.java new file mode 100644 index 000000000000..0b00214330f8 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/DrawingTest.java @@ -0,0 +1,84 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.Fruit; +import org.openapitools.client.model.NullableShape; +import org.openapitools.client.model.Shape; +import org.openapitools.client.model.ShapeOrNull; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Drawing + */ +public class DrawingTest { + private final Drawing model = new Drawing(); + + /** + * Model tests for Drawing + */ + @Test + public void testDrawing() { + // TODO: test Drawing + } + + /** + * Test the property 'mainShape' + */ + @Test + public void mainShapeTest() { + // TODO: test mainShape + } + + /** + * Test the property 'shapeOrNull' + */ + @Test + public void shapeOrNullTest() { + // TODO: test shapeOrNull + } + + /** + * Test the property 'nullableShape' + */ + @Test + public void nullableShapeTest() { + // TODO: test nullableShape + } + + /** + * Test the property 'shapes' + */ + @Test + public void shapesTest() { + // TODO: test shapes + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/EnumArraysTest.java new file mode 100644 index 000000000000..cfb1a337de90 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/EnumArraysTest.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumArrays + */ +public class EnumArraysTest { + private final EnumArrays model = new EnumArrays(); + + /** + * Model tests for EnumArrays + */ + @Test + public void testEnumArrays() { + // TODO: test EnumArrays + } + + /** + * Test the property 'justSymbol' + */ + @Test + public void justSymbolTest() { + // TODO: test justSymbol + } + + /** + * Test the property 'arrayEnum' + */ + @Test + public void arrayEnumTest() { + // TODO: test arrayEnum + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/EnumClassTest.java new file mode 100644 index 000000000000..50fc9572fcdd --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/EnumClassTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumClass + */ +public class EnumClassTest { + /** + * Model tests for EnumClass + */ + @Test + public void testEnumClass() { + // TODO: test EnumClass + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/EnumTestTest.java new file mode 100644 index 000000000000..3fe8f8bce99d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/EnumTestTest.java @@ -0,0 +1,122 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.OuterEnumDefaultValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.openapitools.client.model.OuterEnumIntegerDefaultValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumTest + */ +public class EnumTestTest { + private final EnumTest model = new EnumTest(); + + /** + * Model tests for EnumTest + */ + @Test + public void testEnumTest() { + // TODO: test EnumTest + } + + /** + * Test the property 'enumString' + */ + @Test + public void enumStringTest() { + // TODO: test enumString + } + + /** + * Test the property 'enumStringRequired' + */ + @Test + public void enumStringRequiredTest() { + // TODO: test enumStringRequired + } + + /** + * Test the property 'enumInteger' + */ + @Test + public void enumIntegerTest() { + // TODO: test enumInteger + } + + /** + * Test the property 'enumIntegerOnly' + */ + @Test + public void enumIntegerOnlyTest() { + // TODO: test enumIntegerOnly + } + + /** + * Test the property 'enumNumber' + */ + @Test + public void enumNumberTest() { + // TODO: test enumNumber + } + + /** + * Test the property 'outerEnum' + */ + @Test + public void outerEnumTest() { + // TODO: test outerEnum + } + + /** + * Test the property 'outerEnumInteger' + */ + @Test + public void outerEnumIntegerTest() { + // TODO: test outerEnumInteger + } + + /** + * Test the property 'outerEnumDefaultValue' + */ + @Test + public void outerEnumDefaultValueTest() { + // TODO: test outerEnumDefaultValue + } + + /** + * Test the property 'outerEnumIntegerDefaultValue' + */ + @Test + public void outerEnumIntegerDefaultValueTest() { + // TODO: test outerEnumIntegerDefaultValue + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java new file mode 100644 index 000000000000..c5236c89e195 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EquilateralTriangle + */ +public class EquilateralTriangleTest { + private final EquilateralTriangle model = new EquilateralTriangle(); + + /** + * Model tests for EquilateralTriangle + */ + @Test + public void testEquilateralTriangle() { + // TODO: test EquilateralTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java new file mode 100644 index 000000000000..aad267bb2416 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java @@ -0,0 +1,61 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.ModelFile; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FileSchemaTestClass + */ +public class FileSchemaTestClassTest { + private final FileSchemaTestClass model = new FileSchemaTestClass(); + + /** + * Model tests for FileSchemaTestClass + */ + @Test + public void testFileSchemaTestClass() { + // TODO: test FileSchemaTestClass + } + + /** + * Test the property '_file' + */ + @Test + public void _fileTest() { + // TODO: test _file + } + + /** + * Test the property 'files' + */ + @Test + public void filesTest() { + // TODO: test files + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FooTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FooTest.java new file mode 100644 index 000000000000..4a1f200121eb --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FooTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Foo + */ +public class FooTest { + private final Foo model = new Foo(); + + /** + * Model tests for Foo + */ + @Test + public void testFoo() { + // TODO: test Foo + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FormatTestTest.java new file mode 100644 index 000000000000..68a894af142b --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -0,0 +1,175 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FormatTest + */ +public class FormatTestTest { + private final FormatTest model = new FormatTest(); + + /** + * Model tests for FormatTest + */ + @Test + public void testFormatTest() { + // TODO: test FormatTest + } + + /** + * Test the property 'integer' + */ + @Test + public void integerTest() { + // TODO: test integer + } + + /** + * Test the property 'int32' + */ + @Test + public void int32Test() { + // TODO: test int32 + } + + /** + * Test the property 'int64' + */ + @Test + public void int64Test() { + // TODO: test int64 + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property '_float' + */ + @Test + public void _floatTest() { + // TODO: test _float + } + + /** + * Test the property '_double' + */ + @Test + public void _doubleTest() { + // TODO: test _double + } + + /** + * Test the property 'decimal' + */ + @Test + public void decimalTest() { + // TODO: test decimal + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + + /** + * Test the property '_byte' + */ + @Test + public void _byteTest() { + // TODO: test _byte + } + + /** + * Test the property 'binary' + */ + @Test + public void binaryTest() { + // TODO: test binary + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'patternWithDigits' + */ + @Test + public void patternWithDigitsTest() { + // TODO: test patternWithDigits + } + + /** + * Test the property 'patternWithDigitsAndDelimiter' + */ + @Test + public void patternWithDigitsAndDelimiterTest() { + // TODO: test patternWithDigitsAndDelimiter + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FruitReqTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FruitReqTest.java new file mode 100644 index 000000000000..1e1dfda43c9d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FruitReqTest.java @@ -0,0 +1,77 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FruitReq + */ +public class FruitReqTest { + private final FruitReq model = new FruitReq(); + + /** + * Model tests for FruitReq + */ + @Test + public void testFruitReq() { + // TODO: test FruitReq + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'mealy' + */ + @Test + public void mealyTest() { + // TODO: test mealy + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + + /** + * Test the property 'sweet' + */ + @Test + public void sweetTest() { + // TODO: test sweet + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FruitTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FruitTest.java new file mode 100644 index 000000000000..5cb1cf300bb4 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FruitTest.java @@ -0,0 +1,69 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Fruit + */ +public class FruitTest { + private final Fruit model = new Fruit(); + + /** + * Model tests for Fruit + */ + @Test + public void testFruit() { + // TODO: test Fruit + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/GmFruitTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/GmFruitTest.java new file mode 100644 index 000000000000..5b9e5aba2c19 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/GmFruitTest.java @@ -0,0 +1,69 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for GmFruit + */ +public class GmFruitTest { + private final GmFruit model = new GmFruit(); + + /** + * Model tests for GmFruit + */ + @Test + public void testGmFruit() { + // TODO: test GmFruit + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java new file mode 100644 index 000000000000..b6c369b5e405 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ChildCat; +import org.openapitools.client.model.ParentPet; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for GrandparentAnimal + */ +public class GrandparentAnimalTest { + private final GrandparentAnimal model = new GrandparentAnimal(); + + /** + * Model tests for GrandparentAnimal + */ + @Test + public void testGrandparentAnimal() { + // TODO: test GrandparentAnimal + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java new file mode 100644 index 000000000000..2102a335f53b --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HasOnlyReadOnly + */ +public class HasOnlyReadOnlyTest { + private final HasOnlyReadOnly model = new HasOnlyReadOnly(); + + /** + * Model tests for HasOnlyReadOnly + */ + @Test + public void testHasOnlyReadOnly() { + // TODO: test HasOnlyReadOnly + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'foo' + */ + @Test + public void fooTest() { + // TODO: test foo + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java new file mode 100644 index 000000000000..db11384e8c41 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HealthCheckResult + */ +public class HealthCheckResultTest { + private final HealthCheckResult model = new HealthCheckResult(); + + /** + * Model tests for HealthCheckResult + */ + @Test + public void testHealthCheckResult() { + // TODO: test HealthCheckResult + } + + /** + * Test the property 'nullableMessage' + */ + @Test + public void nullableMessageTest() { + // TODO: test nullableMessage + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/InlineResponseDefaultTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/InlineResponseDefaultTest.java new file mode 100644 index 000000000000..a8c56aa226ff --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/InlineResponseDefaultTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Foo; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for InlineResponseDefault + */ +public class InlineResponseDefaultTest { + private final InlineResponseDefault model = new InlineResponseDefault(); + + /** + * Model tests for InlineResponseDefault + */ + @Test + public void testInlineResponseDefault() { + // TODO: test InlineResponseDefault + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java new file mode 100644 index 000000000000..fc5cf03cfe4b --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for IsoscelesTriangle + */ +public class IsoscelesTriangleTest { + private final IsoscelesTriangle model = new IsoscelesTriangle(); + + /** + * Model tests for IsoscelesTriangle + */ + @Test + public void testIsoscelesTriangle() { + // TODO: test IsoscelesTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/MammalTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/MammalTest.java new file mode 100644 index 000000000000..209262fde520 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/MammalTest.java @@ -0,0 +1,133 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.JSON; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Mammal + */ +public class MammalTest { + private final Mammal model = new Mammal(); + + /** + * Model tests for Mammal + */ + @Test + public void testMammal() throws Exception { + Mammal m = new Mammal(); + Zebra z = new Zebra(); + z.setType(Zebra.TypeEnum.MOUNTAIN); + z.setClassName("zebra"); + m.setActualInstance(z); + Assertions.assertEquals(JSON.getDefault().getMapper().writeValueAsString(m), "{\"type\":\"mountain\",\"className\":\"zebra\"}"); + } + + /** + * Model tests for getActualInstanceRecursively + */ + @Test + public void testGetActualInstanceRecursively() throws Exception { + Mammal m = new Mammal(); + Pig p = new Pig(); + DanishPig dp = new DanishPig(); + dp.setClassName("danish_pig"); + p.setActualInstance(dp); + m.setActualInstance(p); + Assertions.assertTrue(m.getActualInstanceRecursively() instanceof DanishPig); + + Pig p2 = new Pig(); + m.setActualInstance(p2); + Assertions.assertEquals(m.getActualInstanceRecursively(), null); + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test code sample + */ + @Test + public void codeSampleTest() { + Mammal exampleMammal = new Mammal(); + + // create a new Pig + Pig examplePig = new Pig(); + // set Mammal to Pig + exampleMammal.setActualInstance(examplePig); + // to get back the Pig set earlier + Pig testPig = (Pig) exampleMammal.getActualInstance(); + + // create a new Whale + Whale exampleWhale = new Whale(); + // set Mammal to Whale + exampleMammal.setActualInstance(exampleWhale); + // to get back the Whale set earlier + Whale testWhale = (Whale) exampleMammal.getActualInstance(); + + // create a new Zebra + Zebra exampleZebra = new Zebra(); + // set Mammal to Zebra + exampleMammal.setActualInstance(exampleZebra); + // to get back the Zebra set earlier + Zebra testZebra = (Zebra) exampleMammal.getActualInstance(); + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/MapTestTest.java new file mode 100644 index 000000000000..b8483619edfb --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/MapTestTest.java @@ -0,0 +1,77 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MapTest + */ +public class MapTestTest { + private final MapTest model = new MapTest(); + + /** + * Model tests for MapTest + */ + @Test + public void testMapTest() { + // TODO: test MapTest + } + + /** + * Test the property 'mapMapOfString' + */ + @Test + public void mapMapOfStringTest() { + // TODO: test mapMapOfString + } + + /** + * Test the property 'mapOfEnumString' + */ + @Test + public void mapOfEnumStringTest() { + // TODO: test mapOfEnumString + } + + /** + * Test the property 'directMap' + */ + @Test + public void directMapTest() { + // TODO: test directMap + } + + /** + * Test the property 'indirectMap' + */ + @Test + public void indirectMapTest() { + // TODO: test indirectMap + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..a8c724138097 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ +public class MixedPropertiesAndAdditionalPropertiesClassTest { + private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass(); + + /** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ + @Test + public void testMixedPropertiesAndAdditionalPropertiesClass() { + // TODO: test MixedPropertiesAndAdditionalPropertiesClass + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'map' + */ + @Test + public void mapTest() { + // TODO: test map + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/Model200ResponseTest.java new file mode 100644 index 000000000000..9a98de5ff16d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/Model200ResponseTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Model200Response + */ +public class Model200ResponseTest { + private final Model200Response model = new Model200Response(); + + /** + * Model tests for Model200Response + */ + @Test + public void testModel200Response() { + // TODO: test Model200Response + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..31fe5cea6c4b --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.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/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ModelFileTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ModelFileTest.java new file mode 100644 index 000000000000..2fad149d668b --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ModelFileTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelFile + */ +public class ModelFileTest { + private final ModelFile model = new ModelFile(); + + /** + * Model tests for ModelFile + */ + @Test + public void testModelFile() { + // TODO: test ModelFile + } + + /** + * Test the property 'sourceURI' + */ + @Test + public void sourceURITest() { + // TODO: test sourceURI + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ModelListTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ModelListTest.java new file mode 100644 index 000000000000..3c7f35ce7291 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ModelListTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelList + */ +public class ModelListTest { + private final ModelList model = new ModelList(); + + /** + * Model tests for ModelList + */ + @Test + public void testModelList() { + // TODO: test ModelList + } + + /** + * Test the property '_123list' + */ + @Test + public void _123listTest() { + // TODO: test _123list + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ModelReturnTest.java new file mode 100644 index 000000000000..0d3f00e6fc46 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ModelReturnTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelReturn + */ +public class ModelReturnTest { + private final ModelReturn model = new ModelReturn(); + + /** + * Model tests for ModelReturn + */ + @Test + public void testModelReturn() { + // TODO: test ModelReturn + } + + /** + * Test the property '_return' + */ + @Test + public void _returnTest() { + // TODO: test _return + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/NameTest.java new file mode 100644 index 000000000000..8a50c814697b --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/NameTest.java @@ -0,0 +1,74 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Name + */ +public class NameTest { + private final Name model = new Name(); + + /** + * Model tests for Name + */ + @Test + public void testName() { + // TODO: test Name + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'snakeCase' + */ + @Test + public void snakeCaseTest() { + // TODO: test snakeCase + } + + /** + * Test the property 'property' + */ + @Test + public void propertyTest() { + // TODO: test property + } + + /** + * Test the property '_123number' + */ + @Test + public void _123numberTest() { + // TODO: test _123number + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/NullableClassTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/NullableClassTest.java new file mode 100644 index 000000000000..fbeeed0b7624 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/NullableClassTest.java @@ -0,0 +1,149 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableClass + */ +public class NullableClassTest { + private final NullableClass model = new NullableClass(); + + /** + * Model tests for NullableClass + */ + @Test + public void testNullableClass() { + // TODO: test NullableClass + } + + /** + * Test the property 'integerProp' + */ + @Test + public void integerPropTest() { + // TODO: test integerProp + } + + /** + * Test the property 'numberProp' + */ + @Test + public void numberPropTest() { + // TODO: test numberProp + } + + /** + * Test the property 'booleanProp' + */ + @Test + public void booleanPropTest() { + // TODO: test booleanProp + } + + /** + * Test the property 'stringProp' + */ + @Test + public void stringPropTest() { + // TODO: test stringProp + } + + /** + * Test the property 'dateProp' + */ + @Test + public void datePropTest() { + // TODO: test dateProp + } + + /** + * Test the property 'datetimeProp' + */ + @Test + public void datetimePropTest() { + // TODO: test datetimeProp + } + + /** + * Test the property 'arrayNullableProp' + */ + @Test + public void arrayNullablePropTest() { + // TODO: test arrayNullableProp + } + + /** + * Test the property 'arrayAndItemsNullableProp' + */ + @Test + public void arrayAndItemsNullablePropTest() { + // TODO: test arrayAndItemsNullableProp + } + + /** + * Test the property 'arrayItemsNullable' + */ + @Test + public void arrayItemsNullableTest() { + // TODO: test arrayItemsNullable + } + + /** + * Test the property 'objectNullableProp' + */ + @Test + public void objectNullablePropTest() { + // TODO: test objectNullableProp + } + + /** + * Test the property 'objectAndItemsNullableProp' + */ + @Test + public void objectAndItemsNullablePropTest() { + // TODO: test objectAndItemsNullableProp + } + + /** + * Test the property 'objectItemsNullable' + */ + @Test + public void objectItemsNullableTest() { + // TODO: test objectItemsNullable + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/NullableShapeTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/NullableShapeTest.java new file mode 100644 index 000000000000..9ae3eba5aa66 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/NullableShapeTest.java @@ -0,0 +1,71 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableShape + */ +public class NullableShapeTest { + private final NullableShape model = new NullableShape(); + + /** + * Model tests for NullableShape + */ + @Test + public void testNullableShape() { + // TODO: test NullableShape + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/NumberOnlyTest.java new file mode 100644 index 000000000000..c7e5efc28ccd --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/NumberOnlyTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NumberOnly + */ +public class NumberOnlyTest { + private final NumberOnly model = new NumberOnly(); + + /** + * Model tests for NumberOnly + */ + @Test + public void testNumberOnly() { + // TODO: test NumberOnly + } + + /** + * Test the property 'justNumber' + */ + @Test + public void justNumberTest() { + // TODO: test justNumber + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java new file mode 100644 index 000000000000..1ecac2abcf28 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java @@ -0,0 +1,78 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.DeprecatedObject; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ObjectWithDeprecatedFields + */ +public class ObjectWithDeprecatedFieldsTest { + private final ObjectWithDeprecatedFields model = new ObjectWithDeprecatedFields(); + + /** + * Model tests for ObjectWithDeprecatedFields + */ + @Test + public void testObjectWithDeprecatedFields() { + // TODO: test ObjectWithDeprecatedFields + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'deprecatedRef' + */ + @Test + public void deprecatedRefTest() { + // TODO: test deprecatedRef + } + + /** + * Test the property 'bars' + */ + @Test + public void barsTest() { + // TODO: test bars + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..22743d42dd48 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,91 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.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/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterCompositeTest.java new file mode 100644 index 000000000000..0eab13de6999 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterCompositeTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterComposite + */ +public class OuterCompositeTest { + private final OuterComposite model = new OuterComposite(); + + /** + * Model tests for OuterComposite + */ + @Test + public void testOuterComposite() { + // TODO: test OuterComposite + } + + /** + * Test the property 'myNumber' + */ + @Test + public void myNumberTest() { + // TODO: test myNumber + } + + /** + * Test the property 'myString' + */ + @Test + public void myStringTest() { + // TODO: test myString + } + + /** + * Test the property 'myBoolean' + */ + @Test + public void myBooleanTest() { + // TODO: test myBoolean + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java new file mode 100644 index 000000000000..5e6c1ecb1587 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumDefaultValue + */ +public class OuterEnumDefaultValueTest { + /** + * Model tests for OuterEnumDefaultValue + */ + @Test + public void testOuterEnumDefaultValue() { + // TODO: test OuterEnumDefaultValue + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java new file mode 100644 index 000000000000..226897579ad2 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumIntegerDefaultValue + */ +public class OuterEnumIntegerDefaultValueTest { + /** + * Model tests for OuterEnumIntegerDefaultValue + */ + @Test + public void testOuterEnumIntegerDefaultValue() { + // TODO: test OuterEnumIntegerDefaultValue + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java new file mode 100644 index 000000000000..61330bb05eea --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumInteger + */ +public class OuterEnumIntegerTest { + /** + * Model tests for OuterEnumInteger + */ + @Test + public void testOuterEnumInteger() { + // TODO: test OuterEnumInteger + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterEnumTest.java new file mode 100644 index 000000000000..052ad003478d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/OuterEnumTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnum + */ +public class OuterEnumTest { + /** + * Model tests for OuterEnum + */ + @Test + public void testOuterEnum() { + // TODO: test OuterEnum + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ParentPetTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ParentPetTest.java new file mode 100644 index 000000000000..99209770aaed --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ParentPetTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ChildCat; +import org.openapitools.client.model.GrandparentAnimal; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ParentPet + */ +public class ParentPetTest { + private final ParentPet model = new ParentPet(); + + /** + * Model tests for ParentPet + */ + @Test + public void testParentPet() { + // TODO: test ParentPet + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..a1ebb6782c3f --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,94 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.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/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/PigTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/PigTest.java new file mode 100644 index 000000000000..f3c0218c837d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/PigTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.DanishPig; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pig + */ +public class PigTest { + private final Pig model = new Pig(); + + /** + * Model tests for Pig + */ + @Test + public void testPig() { + // TODO: test Pig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java new file mode 100644 index 000000000000..e2d81c731720 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for QuadrilateralInterface + */ +public class QuadrilateralInterfaceTest { + private final QuadrilateralInterface model = new QuadrilateralInterface(); + + /** + * Model tests for QuadrilateralInterface + */ + @Test + public void testQuadrilateralInterface() { + // TODO: test QuadrilateralInterface + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/QuadrilateralTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/QuadrilateralTest.java new file mode 100644 index 000000000000..54d0189f8db5 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/QuadrilateralTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Quadrilateral + */ +public class QuadrilateralTest { + private final Quadrilateral model = new Quadrilateral(); + + /** + * Model tests for Quadrilateral + */ + @Test + public void testQuadrilateral() { + // TODO: test Quadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java new file mode 100644 index 000000000000..86f8a92da18d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadOnlyFirst + */ +public class ReadOnlyFirstTest { + private final ReadOnlyFirst model = new ReadOnlyFirst(); + + /** + * Model tests for ReadOnlyFirst + */ + @Test + public void testReadOnlyFirst() { + // TODO: test ReadOnlyFirst + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'baz' + */ + @Test + public void bazTest() { + // TODO: test baz + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java new file mode 100644 index 000000000000..0e96e8ba04cd --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ScaleneTriangle + */ +public class ScaleneTriangleTest { + private final ScaleneTriangle model = new ScaleneTriangle(); + + /** + * Model tests for ScaleneTriangle + */ + @Test + public void testScaleneTriangle() { + // TODO: test ScaleneTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java new file mode 100644 index 000000000000..fa26c0fe98ed --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ShapeInterface + */ +public class ShapeInterfaceTest { + private final ShapeInterface model = new ShapeInterface(); + + /** + * Model tests for ShapeInterface + */ + @Test + public void testShapeInterface() { + // TODO: test ShapeInterface + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java new file mode 100644 index 000000000000..dfe730ca97a9 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java @@ -0,0 +1,71 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ShapeOrNull + */ +public class ShapeOrNullTest { + private final ShapeOrNull model = new ShapeOrNull(); + + /** + * Model tests for ShapeOrNull + */ + @Test + public void testShapeOrNull() { + // TODO: test ShapeOrNull + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ShapeTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ShapeTest.java new file mode 100644 index 000000000000..8249ec7bba1a --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ShapeTest.java @@ -0,0 +1,71 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Shape + */ +public class ShapeTest { + private final Shape model = new Shape(); + + /** + * Model tests for Shape + */ + @Test + public void testShape() { + // TODO: test Shape + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java new file mode 100644 index 000000000000..a21fd430e4ed --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.QuadrilateralInterface; +import org.openapitools.client.model.ShapeInterface; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SimpleQuadrilateral + */ +public class SimpleQuadrilateralTest { + private final SimpleQuadrilateral model = new SimpleQuadrilateral(); + + /** + * Model tests for SimpleQuadrilateral + */ + @Test + public void testSimpleQuadrilateral() { + // TODO: test SimpleQuadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java new file mode 100644 index 000000000000..991753f718ff --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SpecialModelName + */ +public class SpecialModelNameTest { + private final SpecialModelName model = new SpecialModelName(); + + /** + * Model tests for SpecialModelName + */ + @Test + public void testSpecialModelName() { + // TODO: test SpecialModelName + } + + /** + * Test the property '$specialPropertyName' + */ + @Test + public void $specialPropertyNameTest() { + // TODO: test $specialPropertyName + } + + /** + * Test the property 'specialModelName' + */ + @Test + public void specialModelNameTest() { + // TODO: test specialModelName + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..97e1aa2743a5 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.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/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java new file mode 100644 index 000000000000..4fdd985d127f --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TriangleInterface + */ +public class TriangleInterfaceTest { + private final TriangleInterface model = new TriangleInterface(); + + /** + * Model tests for TriangleInterface + */ + @Test + public void testTriangleInterface() { + // TODO: test TriangleInterface + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/TriangleTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/TriangleTest.java new file mode 100644 index 000000000000..d1dea3a429d3 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/TriangleTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.EquilateralTriangle; +import org.openapitools.client.model.IsoscelesTriangle; +import org.openapitools.client.model.ScaleneTriangle; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Triangle + */ +public class TriangleTest { + private final Triangle model = new Triangle(); + + /** + * Model tests for Triangle + */ + @Test + public void testTriangle() { + // TODO: test Triangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..dc7ea6d5e9c5 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,142 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.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 + } + + /** + * Test the property 'objectWithNoDeclaredProps' + */ + @Test + public void objectWithNoDeclaredPropsTest() { + // TODO: test objectWithNoDeclaredProps + } + + /** + * Test the property 'objectWithNoDeclaredPropsNullable' + */ + @Test + public void objectWithNoDeclaredPropsNullableTest() { + // TODO: test objectWithNoDeclaredPropsNullable + } + + /** + * Test the property 'anyTypeProp' + */ + @Test + public void anyTypePropTest() { + // TODO: test anyTypeProp + } + + /** + * Test the property 'anyTypePropNullable' + */ + @Test + public void anyTypePropNullableTest() { + // TODO: test anyTypePropNullable + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/WhaleTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/WhaleTest.java new file mode 100644 index 000000000000..674ec1456e8a --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/WhaleTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Whale + */ +public class WhaleTest { + private final Whale model = new Whale(); + + /** + * Model tests for Whale + */ + @Test + public void testWhale() { + // TODO: test Whale + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ZebraTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ZebraTest.java new file mode 100644 index 000000000000..4bd27dc0f12a --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/ZebraTest.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.databind.type.MapType; +import com.fasterxml.jackson.databind.type.TypeFactory; +import com.fasterxml.jackson.core.type.TypeReference; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.HashMap; +import java.util.Map; + +import org.openapitools.client.JSON; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Zebra + */ +public class ZebraTest { + private final Zebra model = new Zebra(); + + /** + * Model tests for Zebra + */ + @Test + public void testZebra() { + Zebra z = new Zebra(); + z.setClassName("zebra"); + Map m = new HashMap<>(); + z.putAdditionalProperty("key1", "value1"); + z.putAdditionalProperty("key2", 12321); + z.setType(Zebra.TypeEnum.MOUNTAIN); + + JSON j = new JSON(); + try { + // serialize + Assertions.assertEquals(j.getMapper().writeValueAsString(z), "{\"type\":\"mountain\",\"className\":\"zebra\",\"key1\":\"value1\",\"key2\":12321}"); + + // deserialize + String zebraJson = "{\"type\":\"mountain\",\"className\":\"zebra\",\"key1\":\"value1\",\"key2\":12321}"; + Zebra zebraFromJson = j.getMapper().readValue(zebraJson, Zebra.class); + Assertions.assertEquals(zebraFromJson.getType(), Zebra.TypeEnum.MOUNTAIN); + Assertions.assertEquals(zebraFromJson.getClassName(), "zebra"); + Assertions.assertEquals(zebraFromJson.getAdditionalProperties().size(), 2); + Assertions.assertEquals(zebraFromJson.getAdditionalProperty("key1"), "value1"); + Assertions.assertEquals(zebraFromJson.getAdditionalProperty("key2"), 12321); + } catch (Exception ex) { + Assertions.assertEquals(true, false); // exception shouldn't be thrown + } + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + String zebraJson = "{\"type\":\"mountain\",\"className\":\"zebra\",\"key1\":\"value1\",\"key2\":12321}"; + + JSON j = new JSON(); + TypeFactory typeFactory = j.getMapper().getTypeFactory(); + MapType mapType = typeFactory.constructMapType(HashMap.class, String.class, Object.class); + try { + HashMap map = j.getMapper().readValue(zebraJson, mapType); + Assertions.assertEquals(map.get("type"), "mountain"); + + Map result = + j.getMapper().readValue(zebraJson, new TypeReference>() {}); + + Assertions.assertEquals(result.get("type"), "mountain"); + } catch (Exception ex) { + Assertions.assertEquals(true, false); // exception shouldn't be thrown + } + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 49863b810f96..7e27ea5e65b4 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -152,6 +152,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesAnyType` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 0fc1be93562e..4a5b73a6054c 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -153,6 +153,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesArray` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 89e862d1923a..070f06150e5d 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -152,6 +152,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesBoolean` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index 8f64c9d97ba8..b22e41189239 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -152,6 +152,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesInteger` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index a8234bcf7e64..968eee748c34 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -153,6 +153,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesNumber` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 34bd7cf85af9..f50e8bd73b57 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -153,6 +153,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesObject` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 53bdad451ba0..226958743959 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -152,6 +152,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesString` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 069a75250d90..b2b1a6b2469f 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -163,6 +163,10 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ArrayOfArrayOfNumberOnly` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + // ensure the json data is an array + if (jsonObj.get("ArrayArrayNumber") != null && !jsonObj.get("ArrayArrayNumber").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ArrayArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayArrayNumber").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index ba13b60eba58..6d17c1826d26 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -163,6 +163,10 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ArrayOfNumberOnly` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + // ensure the json data is an array + if (jsonObj.get("ArrayNumber") != null && !jsonObj.get("ArrayNumber").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayNumber").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java index 0818da8bf7ef..51d01d2a389c 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -239,6 +239,18 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ArrayTest` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + // ensure the json data is an array + if (jsonObj.get("array_of_string") != null && !jsonObj.get("array_of_string").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_of_string` to be an array in the JSON string but got `%s`", jsonObj.get("array_of_string").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_array_of_integer") != null && !jsonObj.get("array_array_of_integer").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_array_of_integer` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_integer").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_array_of_model") != null && !jsonObj.get("array_array_of_model").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_array_of_model` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_model").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 7397f33456d9..ba8b6753c1fb 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -203,6 +203,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BigCatAllOf` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("kind") != null && !jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java index a482106372c6..12a0f496eb4f 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java @@ -302,6 +302,24 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Capitalization` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("smallCamel") != null && !jsonObj.get("smallCamel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `smallCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("smallCamel").toString())); + } + if (jsonObj.get("CapitalCamel") != null && !jsonObj.get("CapitalCamel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `CapitalCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("CapitalCamel").toString())); + } + if (jsonObj.get("small_Snake") != null && !jsonObj.get("small_Snake").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `small_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("small_Snake").toString())); + } + if (jsonObj.get("Capital_Snake") != null && !jsonObj.get("Capital_Snake").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `Capital_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Capital_Snake").toString())); + } + if (jsonObj.get("SCA_ETH_Flow_Points") != null && !jsonObj.get("SCA_ETH_Flow_Points").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `SCA_ETH_Flow_Points` to be a primitive type in the JSON string but got `%s`", jsonObj.get("SCA_ETH_Flow_Points").toString())); + } + if (jsonObj.get("ATT_NAME") != null && !jsonObj.get("ATT_NAME").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ATT_NAME` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ATT_NAME").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java index 09c3a32f96c9..b8d5b31d26e9 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java @@ -190,6 +190,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java index 1e05d3d250e0..bea305e83a39 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java @@ -153,6 +153,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassModel` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("_class") != null && !jsonObj.get("_class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `_class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_class").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java index 33d27097ae95..f9e9b104d87c 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java @@ -152,6 +152,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Client` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("client") != null && !jsonObj.get("client").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `client` to be a primitive type in the JSON string but got `%s`", jsonObj.get("client").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/DogAllOf.java index 11c508ac4247..a7feaacc9c69 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -152,6 +152,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DogAllOf` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("breed") != null && !jsonObj.get("breed").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `breed` to be a primitive type in the JSON string but got `%s`", jsonObj.get("breed").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java index 9d6f86e6304d..f7355cf6ec89 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -286,6 +286,13 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EnumArrays` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `just_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("just_symbol").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_enum") != null && !jsonObj.get("array_enum").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_enum` to be an array in the JSON string but got `%s`", jsonObj.get("array_enum").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java index 2e362623c56d..b9d11861dffc 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java @@ -473,6 +473,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `enum_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string").toString())); + } + if (jsonObj.get("enum_string_required") != null && !jsonObj.get("enum_string_required").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `enum_string_required` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string_required").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index e80138080dd5..6ec83ac69dca 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -198,8 +198,13 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { ModelFile.validateJsonObject(jsonObj.getAsJsonObject("file")); } JsonArray jsonArrayfiles = jsonObj.getAsJsonArray("files"); - // validate the optional field `files` (array) if (jsonArrayfiles != null) { + // ensure the json data is an array + if (!jsonObj.get("files").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `files` to be an array in the JSON string but got `%s`", jsonObj.get("files").toString())); + } + + // validate the optional field `files` (array) for (int i = 0; i < jsonArrayfiles.size(); i++) { ModelFile.validateJsonObject(jsonArrayfiles.get(i).getAsJsonObject()); }; diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java index c3303f0d308c..2871b5d349df 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java @@ -568,6 +568,15 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("string") != null && !jsonObj.get("string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string").toString())); + } + if (jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } + if (jsonObj.get("password") != null && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 93ddf904d27e..6a2705dfaf40 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -174,6 +174,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `HasOnlyReadOnly` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } + if (jsonObj.get("foo") != null && !jsonObj.get("foo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `foo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("foo").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index fa7d518ecc85..93b6df854a7e 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -226,6 +226,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MixedPropertiesAndAdditionalPropertiesClass` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java index 4e458896b709..d8a11eac09f2 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java @@ -183,6 +183,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Model200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("class") != null && !jsonObj.get("class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("class").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java index c4315fea9d69..332723cf37c3 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -212,6 +212,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelApiResponse` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (jsonObj.get("message") != null && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java index fc8bfad0d5d3..d73e3b49a31b 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java @@ -153,6 +153,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelFile` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("sourceURI") != null && !jsonObj.get("sourceURI").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `sourceURI` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceURI").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java index b2b739622985..c21791d118f0 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java @@ -152,6 +152,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelList` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("123-list") != null && !jsonObj.get("123-list").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `123-list` to be a primitive type in the JSON string but got `%s`", jsonObj.get("123-list").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java index a1ec8f23afa4..e253e6e37927 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java @@ -243,6 +243,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("property") != null && !jsonObj.get("property").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `property` to be a primitive type in the JSON string but got `%s`", jsonObj.get("property").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java index c7c155222441..c4f00ec9c7d5 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java @@ -352,6 +352,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Order` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java index fbfdbac3ff02..acc2fba781a3 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -213,6 +213,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OuterComposite` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("my_string") != null && !jsonObj.get("my_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `my_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("my_string").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java index c304b2d69388..b8c3d9b927f8 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java @@ -383,13 +383,28 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj.getAsJsonObject("category") != null) { Category.validateJsonObject(jsonObj.getAsJsonObject("category")); } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the json data is an array + if (jsonObj.get("photoUrls") != null && !jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); - // validate the optional field `tags` (array) if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) for (int i = 0; i < jsonArraytags.size(); i++) { Tag.validateJsonObject(jsonArraytags.get(i).getAsJsonObject()); }; } + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index e25fcec4f0ac..b535ed95846f 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -181,6 +181,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReadOnlyFirst` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } + if (jsonObj.get("baz") != null && !jsonObj.get("baz").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `baz` to be a primitive type in the JSON string but got `%s`", jsonObj.get("baz").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java index f31e137d9e1e..e22d3eb088c8 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java @@ -182,6 +182,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Tag` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 7bd32382a8b1..e91430614dfb 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -292,6 +292,13 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("string_item") != null && !jsonObj.get("string_item").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `string_item` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_item").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_item") != null && !jsonObj.get("array_item").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_item` to be an array in the JSON string but got `%s`", jsonObj.get("array_item").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 205c4f7c96ee..c1c3f05b6383 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -323,6 +323,13 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("string_item") != null && !jsonObj.get("string_item").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `string_item` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_item").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_item") != null && !jsonObj.get("array_item").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_item` to be an array in the JSON string but got `%s`", jsonObj.get("array_item").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java index 16ac1c3a12b4..279649827147 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java @@ -362,6 +362,24 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `User` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("username") != null && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if (jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if (jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if (jsonObj.get("email") != null && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (jsonObj.get("password") != null && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java index 451001aca55e..9a29317b35a4 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java @@ -1067,6 +1067,57 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `XmlItem` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("attribute_string") != null && !jsonObj.get("attribute_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `attribute_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("attribute_string").toString())); + } + // ensure the json data is an array + if (jsonObj.get("wrapped_array") != null && !jsonObj.get("wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("wrapped_array").toString())); + } + if (jsonObj.get("name_string") != null && !jsonObj.get("name_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name_string").toString())); + } + // ensure the json data is an array + if (jsonObj.get("name_array") != null && !jsonObj.get("name_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `name_array` to be an array in the JSON string but got `%s`", jsonObj.get("name_array").toString())); + } + // ensure the json data is an array + if (jsonObj.get("name_wrapped_array") != null && !jsonObj.get("name_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `name_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("name_wrapped_array").toString())); + } + if (jsonObj.get("prefix_string") != null && !jsonObj.get("prefix_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `prefix_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prefix_string").toString())); + } + // ensure the json data is an array + if (jsonObj.get("prefix_array") != null && !jsonObj.get("prefix_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `prefix_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_array").toString())); + } + // ensure the json data is an array + if (jsonObj.get("prefix_wrapped_array") != null && !jsonObj.get("prefix_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `prefix_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_wrapped_array").toString())); + } + if (jsonObj.get("namespace_string") != null && !jsonObj.get("namespace_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `namespace_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace_string").toString())); + } + // ensure the json data is an array + if (jsonObj.get("namespace_array") != null && !jsonObj.get("namespace_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `namespace_array` to be an array in the JSON string but got `%s`", jsonObj.get("namespace_array").toString())); + } + // ensure the json data is an array + if (jsonObj.get("namespace_wrapped_array") != null && !jsonObj.get("namespace_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `namespace_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("namespace_wrapped_array").toString())); + } + if (jsonObj.get("prefix_ns_string") != null && !jsonObj.get("prefix_ns_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `prefix_ns_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prefix_ns_string").toString())); + } + // ensure the json data is an array + if (jsonObj.get("prefix_ns_array") != null && !jsonObj.get("prefix_ns_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `prefix_ns_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_ns_array").toString())); + } + // ensure the json data is an array + if (jsonObj.get("prefix_ns_wrapped_array") != null && !jsonObj.get("prefix_ns_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `prefix_ns_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_ns_wrapped_array").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index c4891251ae05..bedcf0a3b32f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -175,6 +175,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesAnyType` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 2fa930dcd19a..b637892ac11a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -176,6 +176,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesArray` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index af3a0089d942..d023dd595657 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -175,6 +175,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesBoolean` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index 0fb7f34ae409..ab186d35b968 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -175,6 +175,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesInteger` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index ef19a8b3d068..b3bc05c4a45d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -176,6 +176,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesNumber` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 10e9f8673d62..3f7f01262125 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -176,6 +176,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesObject` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 0ad431754245..581737f89737 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -175,6 +175,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesString` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index f787ee9aca8d..f5f17ff974c8 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -186,6 +186,10 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ArrayOfArrayOfNumberOnly` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + // ensure the json data is an array + if (jsonObj.get("ArrayArrayNumber") != null && !jsonObj.get("ArrayArrayNumber").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ArrayArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayArrayNumber").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index baccf49d6df3..307336cb4a30 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -186,6 +186,10 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ArrayOfNumberOnly` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + // ensure the json data is an array + if (jsonObj.get("ArrayNumber") != null && !jsonObj.get("ArrayNumber").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayNumber").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java index 0fbfb86e3da4..6cdb80e931bb 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -266,6 +266,18 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ArrayTest` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + // ensure the json data is an array + if (jsonObj.get("array_of_string") != null && !jsonObj.get("array_of_string").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_of_string` to be an array in the JSON string but got `%s`", jsonObj.get("array_of_string").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_array_of_integer") != null && !jsonObj.get("array_array_of_integer").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_array_of_integer` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_integer").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_array_of_model") != null && !jsonObj.get("array_array_of_model").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_array_of_model` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_model").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 20358f13a243..447847173756 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -226,6 +226,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BigCatAllOf` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("kind") != null && !jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java index e6e2c523149a..67bc10dd2ae3 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java @@ -335,6 +335,24 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Capitalization` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("smallCamel") != null && !jsonObj.get("smallCamel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `smallCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("smallCamel").toString())); + } + if (jsonObj.get("CapitalCamel") != null && !jsonObj.get("CapitalCamel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `CapitalCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("CapitalCamel").toString())); + } + if (jsonObj.get("small_Snake") != null && !jsonObj.get("small_Snake").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `small_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("small_Snake").toString())); + } + if (jsonObj.get("Capital_Snake") != null && !jsonObj.get("Capital_Snake").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `Capital_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Capital_Snake").toString())); + } + if (jsonObj.get("SCA_ETH_Flow_Points") != null && !jsonObj.get("SCA_ETH_Flow_Points").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `SCA_ETH_Flow_Points` to be a primitive type in the JSON string but got `%s`", jsonObj.get("SCA_ETH_Flow_Points").toString())); + } + if (jsonObj.get("ATT_NAME") != null && !jsonObj.get("ATT_NAME").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ATT_NAME` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ATT_NAME").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java index 6f16357d1d4d..77ef37b69b57 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java @@ -215,6 +215,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java index 135db080e095..1140bceb647c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java @@ -176,6 +176,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassModel` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("_class") != null && !jsonObj.get("_class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `_class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_class").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java index d1d5b3ce9021..921b7aad8578 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java @@ -175,6 +175,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Client` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("client") != null && !jsonObj.get("client").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `client` to be a primitive type in the JSON string but got `%s`", jsonObj.get("client").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java index 74a5ec299f26..39d79b9dc705 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -175,6 +175,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DogAllOf` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("breed") != null && !jsonObj.get("breed").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `breed` to be a primitive type in the JSON string but got `%s`", jsonObj.get("breed").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java index 16f81f59badd..35cddfff9fd9 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -311,6 +311,13 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EnumArrays` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `just_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("just_symbol").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_enum") != null && !jsonObj.get("array_enum").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_enum` to be an array in the JSON string but got `%s`", jsonObj.get("array_enum").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java index e557c998d567..46d9c89ef9bf 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java @@ -504,6 +504,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `enum_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string").toString())); + } + if (jsonObj.get("enum_string_required") != null && !jsonObj.get("enum_string_required").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `enum_string_required` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string_required").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 4e4e6d4f417a..9ba801b2f730 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -223,8 +223,13 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { ModelFile.validateJsonObject(jsonObj.getAsJsonObject("file")); } JsonArray jsonArrayfiles = jsonObj.getAsJsonArray("files"); - // validate the optional field `files` (array) if (jsonArrayfiles != null) { + // ensure the json data is an array + if (!jsonObj.get("files").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `files` to be an array in the JSON string but got `%s`", jsonObj.get("files").toString())); + } + + // validate the optional field `files` (array) for (int i = 0; i < jsonArrayfiles.size(); i++) { ModelFile.validateJsonObject(jsonArrayfiles.get(i).getAsJsonObject()); }; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java index 389211d89e49..0da94612ec41 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java @@ -617,6 +617,15 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("string") != null && !jsonObj.get("string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string").toString())); + } + if (jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } + if (jsonObj.get("password") != null && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index ad23c86a063b..67380649b7bd 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -199,6 +199,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `HasOnlyReadOnly` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } + if (jsonObj.get("foo") != null && !jsonObj.get("foo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `foo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("foo").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index c7e2263dbc61..5708bdaecc9d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -253,6 +253,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MixedPropertiesAndAdditionalPropertiesClass` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java index 160687ccf9ad..67b786bdf40d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java @@ -208,6 +208,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Model200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("class") != null && !jsonObj.get("class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("class").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 87bf9c3c3f3d..4062f0b6a47c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -239,6 +239,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelApiResponse` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (jsonObj.get("message") != null && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java index 27dd098b66ee..6913b2d1123f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java @@ -176,6 +176,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelFile` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("sourceURI") != null && !jsonObj.get("sourceURI").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `sourceURI` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceURI").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java index 37f8b6ab93ce..9589c2675233 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java @@ -175,6 +175,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelList` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("123-list") != null && !jsonObj.get("123-list").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `123-list` to be a primitive type in the JSON string but got `%s`", jsonObj.get("123-list").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java index 5371519b8065..adddb5df7424 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java @@ -272,6 +272,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("property") != null && !jsonObj.get("property").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `property` to be a primitive type in the JSON string but got `%s`", jsonObj.get("property").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java index 3e7ffb577298..fc924b6fc7f4 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java @@ -385,6 +385,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Order` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java index fba032f891b5..7bd4b9c27762 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -240,6 +240,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OuterComposite` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("my_string") != null && !jsonObj.get("my_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `my_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("my_string").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java index ba966a8065f9..05d4d1cc89c7 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java @@ -416,13 +416,28 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj.getAsJsonObject("category") != null) { Category.validateJsonObject(jsonObj.getAsJsonObject("category")); } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the json data is an array + if (jsonObj.get("photoUrls") != null && !jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); - // validate the optional field `tags` (array) if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) for (int i = 0; i < jsonArraytags.size(); i++) { Tag.validateJsonObject(jsonArraytags.get(i).getAsJsonObject()); }; } + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index d01f0e2919ed..da565404650d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -206,6 +206,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReadOnlyFirst` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } + if (jsonObj.get("baz") != null && !jsonObj.get("baz").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `baz` to be a primitive type in the JSON string but got `%s`", jsonObj.get("baz").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java index 57e10871c944..d943f3149441 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java @@ -207,6 +207,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Tag` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 018a2116ec60..4039c931e2d7 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -323,6 +323,13 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("string_item") != null && !jsonObj.get("string_item").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `string_item` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_item").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_item") != null && !jsonObj.get("array_item").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_item` to be an array in the JSON string but got `%s`", jsonObj.get("array_item").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 8dfff09772f6..6bd74b7a7404 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -356,6 +356,13 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("string_item") != null && !jsonObj.get("string_item").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `string_item` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_item").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_item") != null && !jsonObj.get("array_item").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_item` to be an array in the JSON string but got `%s`", jsonObj.get("array_item").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java index 8ee8cc13a999..2d7875283695 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java @@ -399,6 +399,24 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `User` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("username") != null && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if (jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if (jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if (jsonObj.get("email") != null && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (jsonObj.get("password") != null && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java index 2ed1bd494a53..cf3eb5fb5dd9 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java @@ -1146,6 +1146,57 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `XmlItem` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("attribute_string") != null && !jsonObj.get("attribute_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `attribute_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("attribute_string").toString())); + } + // ensure the json data is an array + if (jsonObj.get("wrapped_array") != null && !jsonObj.get("wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("wrapped_array").toString())); + } + if (jsonObj.get("name_string") != null && !jsonObj.get("name_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name_string").toString())); + } + // ensure the json data is an array + if (jsonObj.get("name_array") != null && !jsonObj.get("name_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `name_array` to be an array in the JSON string but got `%s`", jsonObj.get("name_array").toString())); + } + // ensure the json data is an array + if (jsonObj.get("name_wrapped_array") != null && !jsonObj.get("name_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `name_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("name_wrapped_array").toString())); + } + if (jsonObj.get("prefix_string") != null && !jsonObj.get("prefix_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `prefix_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prefix_string").toString())); + } + // ensure the json data is an array + if (jsonObj.get("prefix_array") != null && !jsonObj.get("prefix_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `prefix_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_array").toString())); + } + // ensure the json data is an array + if (jsonObj.get("prefix_wrapped_array") != null && !jsonObj.get("prefix_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `prefix_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_wrapped_array").toString())); + } + if (jsonObj.get("namespace_string") != null && !jsonObj.get("namespace_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `namespace_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace_string").toString())); + } + // ensure the json data is an array + if (jsonObj.get("namespace_array") != null && !jsonObj.get("namespace_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `namespace_array` to be an array in the JSON string but got `%s`", jsonObj.get("namespace_array").toString())); + } + // ensure the json data is an array + if (jsonObj.get("namespace_wrapped_array") != null && !jsonObj.get("namespace_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `namespace_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("namespace_wrapped_array").toString())); + } + if (jsonObj.get("prefix_ns_string") != null && !jsonObj.get("prefix_ns_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `prefix_ns_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prefix_ns_string").toString())); + } + // ensure the json data is an array + if (jsonObj.get("prefix_ns_array") != null && !jsonObj.get("prefix_ns_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `prefix_ns_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_ns_array").toString())); + } + // ensure the json data is an array + if (jsonObj.get("prefix_ns_wrapped_array") != null && !jsonObj.get("prefix_ns_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `prefix_ns_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_ns_wrapped_array").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Apple.java index 2628e7e9ee05..2adf6cbbb626 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Apple.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Apple.java @@ -211,6 +211,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in Apple is not found in the empty JSON string", Apple.openapiRequiredFields.toString())); } } + if (jsonObj.get("cultivar") != null && !jsonObj.get("cultivar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cultivar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cultivar").toString())); + } + if (jsonObj.get("origin") != null && !jsonObj.get("origin").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `origin` to be a primitive type in the JSON string but got `%s`", jsonObj.get("origin").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AppleReq.java index ec3ed38203b3..93103ecab9de 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AppleReq.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AppleReq.java @@ -190,6 +190,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("cultivar") != null && !jsonObj.get("cultivar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cultivar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cultivar").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index a059783ee936..62462f94862d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -192,6 +192,10 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfArrayOfNumberOnly is not found in the empty JSON string", ArrayOfArrayOfNumberOnly.openapiRequiredFields.toString())); } } + // ensure the json data is an array + if (jsonObj.get("ArrayArrayNumber") != null && !jsonObj.get("ArrayArrayNumber").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ArrayArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayArrayNumber").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 28adc93cc8d0..44f3b1db199c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -192,6 +192,10 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfNumberOnly is not found in the empty JSON string", ArrayOfNumberOnly.openapiRequiredFields.toString())); } } + // ensure the json data is an array + if (jsonObj.get("ArrayNumber") != null && !jsonObj.get("ArrayNumber").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayNumber").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java index b0b8129f76a0..207dea369b3d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -268,6 +268,18 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayTest is not found in the empty JSON string", ArrayTest.openapiRequiredFields.toString())); } } + // ensure the json data is an array + if (jsonObj.get("array_of_string") != null && !jsonObj.get("array_of_string").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_of_string` to be an array in the JSON string but got `%s`", jsonObj.get("array_of_string").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_array_of_integer") != null && !jsonObj.get("array_array_of_integer").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_array_of_integer` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_integer").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_array_of_model") != null && !jsonObj.get("array_array_of_model").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_array_of_model` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_model").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BasquePig.java index db6c499ddd09..7f144c363101 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BasquePig.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BasquePig.java @@ -189,6 +189,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("className") != null && !jsonObj.get("className").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `className` to be a primitive type in the JSON string but got `%s`", jsonObj.get("className").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java index 07ae5d737f89..6ed0d3d2981e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java @@ -331,6 +331,24 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in Capitalization is not found in the empty JSON string", Capitalization.openapiRequiredFields.toString())); } } + if (jsonObj.get("smallCamel") != null && !jsonObj.get("smallCamel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `smallCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("smallCamel").toString())); + } + if (jsonObj.get("CapitalCamel") != null && !jsonObj.get("CapitalCamel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `CapitalCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("CapitalCamel").toString())); + } + if (jsonObj.get("small_Snake") != null && !jsonObj.get("small_Snake").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `small_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("small_Snake").toString())); + } + if (jsonObj.get("Capital_Snake") != null && !jsonObj.get("Capital_Snake").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `Capital_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Capital_Snake").toString())); + } + if (jsonObj.get("SCA_ETH_Flow_Points") != null && !jsonObj.get("SCA_ETH_Flow_Points").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `SCA_ETH_Flow_Points` to be a primitive type in the JSON string but got `%s`", jsonObj.get("SCA_ETH_Flow_Points").toString())); + } + if (jsonObj.get("ATT_NAME") != null && !jsonObj.get("ATT_NAME").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ATT_NAME` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ATT_NAME").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java index 4c6d35229247..ec5e5fcf2d75 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java @@ -219,6 +219,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java index 3b4d50e782cd..ad4d551f512c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java @@ -182,6 +182,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in ClassModel is not found in the empty JSON string", ClassModel.openapiRequiredFields.toString())); } } + if (jsonObj.get("_class") != null && !jsonObj.get("_class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `_class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_class").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java index 4d594df1b5cb..381036120a1b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java @@ -181,6 +181,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in Client is not found in the empty JSON string", Client.openapiRequiredFields.toString())); } } + if (jsonObj.get("client") != null && !jsonObj.get("client").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `client` to be a primitive type in the JSON string but got `%s`", jsonObj.get("client").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java index efd9f8b15a3e..1a73911047f5 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -222,6 +222,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("shapeType") != null && !jsonObj.get("shapeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); + } + if (jsonObj.get("quadrilateralType") != null && !jsonObj.get("quadrilateralType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `quadrilateralType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("quadrilateralType").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DanishPig.java index 6ca26f3b94bd..02c390dcd7e3 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DanishPig.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DanishPig.java @@ -189,6 +189,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("className") != null && !jsonObj.get("className").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `className` to be a primitive type in the JSON string but got `%s`", jsonObj.get("className").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DeprecatedObject.java index 814f804dbd2b..d1e24af7ffd0 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DeprecatedObject.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -183,6 +183,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in DeprecatedObject is not found in the empty JSON string", DeprecatedObject.openapiRequiredFields.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DogAllOf.java index f971d2f79334..a15a3e0929ac 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -181,6 +181,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in DogAllOf is not found in the empty JSON string", DogAllOf.openapiRequiredFields.toString())); } } + if (jsonObj.get("breed") != null && !jsonObj.get("breed").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `breed` to be a primitive type in the JSON string but got `%s`", jsonObj.get("breed").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Drawing.java index ad498b1d27f9..5318f5afc988 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Drawing.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Drawing.java @@ -281,8 +281,13 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { NullableShape.validateJsonObject(jsonObj.getAsJsonObject("nullableShape")); } JsonArray jsonArrayshapes = jsonObj.getAsJsonArray("shapes"); - // validate the optional field `shapes` (array) if (jsonArrayshapes != null) { + // ensure the json data is an array + if (!jsonObj.get("shapes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `shapes` to be an array in the JSON string but got `%s`", jsonObj.get("shapes").toString())); + } + + // validate the optional field `shapes` (array) for (int i = 0; i < jsonArrayshapes.size(); i++) { Shape.validateJsonObject(jsonArrayshapes.get(i).getAsJsonObject()); }; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java index 27694cf53147..3a705da91612 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -315,6 +315,13 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in EnumArrays is not found in the empty JSON string", EnumArrays.openapiRequiredFields.toString())); } } + if (jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `just_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("just_symbol").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_enum") != null && !jsonObj.get("array_enum").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_enum` to be an array in the JSON string but got `%s`", jsonObj.get("array_enum").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java index 4bda211214a0..0a5892a2034c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java @@ -684,6 +684,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `enum_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string").toString())); + } + if (jsonObj.get("enum_string_required") != null && !jsonObj.get("enum_string_required").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `enum_string_required` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string_required").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java index 92a332c57b79..37e46b978d4b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -222,6 +222,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("shapeType") != null && !jsonObj.get("shapeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); + } + if (jsonObj.get("triangleType") != null && !jsonObj.get("triangleType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `triangleType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("triangleType").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index d115366b3aa3..4bfdfe254c84 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -227,8 +227,13 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { ModelFile.validateJsonObject(jsonObj.getAsJsonObject("file")); } JsonArray jsonArrayfiles = jsonObj.getAsJsonArray("files"); - // validate the optional field `files` (array) if (jsonArrayfiles != null) { + // ensure the json data is an array + if (!jsonObj.get("files").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `files` to be an array in the JSON string but got `%s`", jsonObj.get("files").toString())); + } + + // validate the optional field `files` (array) for (int i = 0; i < jsonArrayfiles.size(); i++) { ModelFile.validateJsonObject(jsonArrayfiles.get(i).getAsJsonObject()); }; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Foo.java index f4923697315d..4d0a5b1fe75e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Foo.java @@ -181,6 +181,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in Foo is not found in the empty JSON string", Foo.openapiRequiredFields.toString())); } } + if (jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java index 23354a95101b..0813672f10a3 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java @@ -657,6 +657,21 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("string") != null && !jsonObj.get("string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string").toString())); + } + if (jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } + if (jsonObj.get("password") != null && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if (jsonObj.get("pattern_with_digits") != null && !jsonObj.get("pattern_with_digits").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `pattern_with_digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pattern_with_digits").toString())); + } + if (jsonObj.get("pattern_with_digits_and_delimiter") != null && !jsonObj.get("pattern_with_digits_and_delimiter").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `pattern_with_digits_and_delimiter` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pattern_with_digits_and_delimiter").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index a8459446634f..654a34acbb39 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -203,6 +203,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in HasOnlyReadOnly is not found in the empty JSON string", HasOnlyReadOnly.openapiRequiredFields.toString())); } } + if (jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } + if (jsonObj.get("foo") != null && !jsonObj.get("foo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `foo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("foo").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HealthCheckResult.java index a60af91c680d..9053adf5a356 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -194,6 +194,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in HealthCheckResult is not found in the empty JSON string", HealthCheckResult.openapiRequiredFields.toString())); } } + if (jsonObj.get("NullableMessage") != null && !jsonObj.get("NullableMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `NullableMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("NullableMessage").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java index 63cf9777d45a..df7563afde93 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -193,6 +193,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("shapeType") != null && !jsonObj.get("shapeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); + } + if (jsonObj.get("triangleType") != null && !jsonObj.get("triangleType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `triangleType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("triangleType").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 8716e1aa1054..f7692be1f1ce 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -255,6 +255,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in MixedPropertiesAndAdditionalPropertiesClass is not found in the empty JSON string", MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.toString())); } } + if (jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java index 12dbd1c1b935..2a50f1d5dd60 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java @@ -212,6 +212,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in Model200Response is not found in the empty JSON string", Model200Response.openapiRequiredFields.toString())); } } + if (jsonObj.get("class") != null && !jsonObj.get("class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("class").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 93082274b4c0..ceae89017c97 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -241,6 +241,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); } } + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (jsonObj.get("message") != null && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelFile.java index d8a9fbedc6d8..19b8d3416533 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelFile.java @@ -182,6 +182,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in ModelFile is not found in the empty JSON string", ModelFile.openapiRequiredFields.toString())); } } + if (jsonObj.get("sourceURI") != null && !jsonObj.get("sourceURI").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `sourceURI` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceURI").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelList.java index 22cc4b4b35ff..c11740aa774c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelList.java @@ -181,6 +181,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in ModelList is not found in the empty JSON string", ModelList.openapiRequiredFields.toString())); } } + if (jsonObj.get("123-list") != null && !jsonObj.get("123-list").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `123-list` to be a primitive type in the JSON string but got `%s`", jsonObj.get("123-list").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java index 358ce110ef38..b0ff9da6091d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java @@ -272,6 +272,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("property") != null && !jsonObj.get("property").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `property` to be a primitive type in the JSON string but got `%s`", jsonObj.get("property").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableClass.java index e5f9dff7bbf0..6c1d46e4f2c4 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableClass.java @@ -549,6 +549,21 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NullableClass` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } + if (jsonObj.get("string_prop") != null && !jsonObj.get("string_prop").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `string_prop` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_prop").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_nullable_prop") != null && !jsonObj.get("array_nullable_prop").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_nullable_prop` to be an array in the JSON string but got `%s`", jsonObj.get("array_nullable_prop").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_and_items_nullable_prop") != null && !jsonObj.get("array_and_items_nullable_prop").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_and_items_nullable_prop` to be an array in the JSON string but got `%s`", jsonObj.get("array_and_items_nullable_prop").toString())); + } + // ensure the json data is an array + if (jsonObj.get("array_items_nullable") != null && !jsonObj.get("array_items_nullable").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `array_items_nullable` to be an array in the JSON string but got `%s`", jsonObj.get("array_items_nullable").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java index c6236d33b6b1..7454088d2e8e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -289,10 +289,17 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in ObjectWithDeprecatedFields is not found in the empty JSON string", ObjectWithDeprecatedFields.openapiRequiredFields.toString())); } } + if (jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } // validate the optional field `deprecatedRef` if (jsonObj.getAsJsonObject("deprecatedRef") != null) { DeprecatedObject.validateJsonObject(jsonObj.getAsJsonObject("deprecatedRef")); } + // ensure the json data is an array + if (jsonObj.get("bars") != null && !jsonObj.get("bars").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `bars` to be an array in the JSON string but got `%s`", jsonObj.get("bars").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java index e50b558adcf4..a56fa5f28a81 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java @@ -381,6 +381,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); } } + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java index 6165386c2f62..011acb3a58c4 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -242,6 +242,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in OuterComposite is not found in the empty JSON string", OuterComposite.openapiRequiredFields.toString())); } } + if (jsonObj.get("my_string") != null && !jsonObj.get("my_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `my_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("my_string").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java index 4bdca38097a5..8078f1b07dca 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java @@ -410,13 +410,28 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj.getAsJsonObject("category") != null) { Category.validateJsonObject(jsonObj.getAsJsonObject("category")); } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the json data is an array + if (jsonObj.get("photoUrls") != null && !jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); - // validate the optional field `tags` (array) if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) for (int i = 0; i < jsonArraytags.size(); i++) { Tag.validateJsonObject(jsonArraytags.get(i).getAsJsonObject()); }; } + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java index cf712f7b2c7f..3fde0c9b9c15 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java @@ -408,13 +408,28 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj.getAsJsonObject("category") != null) { Category.validateJsonObject(jsonObj.getAsJsonObject("category")); } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the json data is an array + if (jsonObj.get("photoUrls") != null && !jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); - // validate the optional field `tags` (array) if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) for (int i = 0; i < jsonArraytags.size(); i++) { Tag.validateJsonObject(jsonArraytags.get(i).getAsJsonObject()); }; } + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java index 87ee8f7debab..e2c3d4b33cdd 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -189,6 +189,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("quadrilateralType") != null && !jsonObj.get("quadrilateralType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `quadrilateralType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("quadrilateralType").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index b0871b4bbaf9..f5c37a84d457 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -210,6 +210,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in ReadOnlyFirst is not found in the empty JSON string", ReadOnlyFirst.openapiRequiredFields.toString())); } } + if (jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } + if (jsonObj.get("baz") != null && !jsonObj.get("baz").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `baz` to be a primitive type in the JSON string but got `%s`", jsonObj.get("baz").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java index e43478d53161..a15c2fa880f4 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -222,6 +222,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("shapeType") != null && !jsonObj.get("shapeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); + } + if (jsonObj.get("triangleType") != null && !jsonObj.get("triangleType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `triangleType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("triangleType").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ShapeInterface.java index 56cd5a3c890d..4eba102348e9 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ShapeInterface.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -189,6 +189,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("shapeType") != null && !jsonObj.get("shapeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java index 3c3302df954b..d08035d83332 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -222,6 +222,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("shapeType") != null && !jsonObj.get("shapeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); + } + if (jsonObj.get("quadrilateralType") != null && !jsonObj.get("quadrilateralType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `quadrilateralType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("quadrilateralType").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java index 9c02de4c2150..c9c51593e804 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -211,6 +211,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in SpecialModelName is not found in the empty JSON string", SpecialModelName.openapiRequiredFields.toString())); } } + if (jsonObj.get("_special_model.name_") != null && !jsonObj.get("_special_model.name_").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `_special_model.name_` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_special_model.name_").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java index f0e66fb00788..34a2a5d9d4f7 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java @@ -211,6 +211,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); } } + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TriangleInterface.java index 5a75bfed7ce4..c4a2b0dfd3cb 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TriangleInterface.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -189,6 +189,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("triangleType") != null && !jsonObj.get("triangleType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `triangleType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("triangleType").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java index a68bb3af37d9..8cfe38da4ae1 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java @@ -523,6 +523,24 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); } } + if (jsonObj.get("username") != null && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if (jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if (jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if (jsonObj.get("email") != null && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (jsonObj.get("password") != null && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Whale.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Whale.java index 1f28563e8fd6..32e54ee066ed 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Whale.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Whale.java @@ -249,6 +249,9 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("className") != null && !jsonObj.get("className").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `className` to be a primitive type in the JSON string but got `%s`", jsonObj.get("className").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Zebra.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Zebra.java index 10e16a4fe59d..788ac740b1da 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Zebra.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Zebra.java @@ -268,6 +268,12 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (jsonObj.get("className") != null && !jsonObj.get("className").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `className` to be a primitive type in the JSON string but got `%s`", jsonObj.get("className").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java index 194fab35ae2d..b24033df2e98 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java @@ -442,6 +442,24 @@ public void testOneOfSchemaWithDiscriminator() throws Exception { } } + /** + * Test JSON validation method + */ + @Test + public void testJsonValidation() throws Exception { + String str = "{ \"cultivar\": [\"golden delicious\"], \"mealy\": false }"; + Exception exception = assertThrows(java.lang.IllegalArgumentException.class, () -> { + AppleReq a = json.getGson().fromJson(str, AppleReq.class); + }); + assertTrue(exception.getMessage().contains("Expected the field `cultivar` to be a primitive type in the JSON string but got `[\"golden delicious\"]`")); + + String str2 = "{ \"id\": 5847, \"name\":\"pet test 1\", \"photoUrls\": 123 }"; + Exception exception2 = assertThrows(java.lang.IllegalArgumentException.class, () -> { + Pet p1 = json.getGson().fromJson(str2, Pet.class); + }); + assertTrue(exception2.getMessage().contains("Expected the field `photoUrls` to be an array in the JSON string but got `123`")); + } + /** * Validate a oneOf schema can be deserialized into the expected class. * The oneOf schema does not have a discriminator. diff --git a/samples/client/petstore/powershell/.openapi-generator/FILES b/samples/client/petstore/powershell/.openapi-generator/FILES index 5f8aa4fd57d6..a23fa36f7ee0 100644 --- a/samples/client/petstore/powershell/.openapi-generator/FILES +++ b/samples/client/petstore/powershell/.openapi-generator/FILES @@ -1,25 +1,163 @@ Build.ps1 README.md appveyor.yml +docs/200Response.md +docs/AdditionalPropertiesClass.md +docs/Animal.md docs/ApiResponse.md +docs/Apple.md +docs/AppleReq.md +docs/ArrayOfArrayOfNumberOnly.md +docs/ArrayOfNumberOnly.md +docs/ArrayTest.md +docs/Banana.md +docs/BananaReq.md +docs/BasquePig.md +docs/Capitalization.md +docs/Cat.md +docs/CatAllOf.md docs/Category.md +docs/ClassModel.md +docs/Client.md +docs/ComplexQuadrilateral.md +docs/DanishPig.md +docs/DeprecatedObject.md +docs/Dog.md +docs/DogAllOf.md +docs/Drawing.md +docs/EnumArrays.md +docs/EnumTest.md +docs/EquilateralTriangle.md +docs/File.md +docs/FileSchemaTestClass.md +docs/Foo.md +docs/FormatTest.md +docs/Fruit.md +docs/FruitReq.md +docs/GmFruit.md +docs/GrandparentAnimal.md +docs/HasOnlyReadOnly.md +docs/HealthCheckResult.md +docs/InlineResponseDefault.md +docs/IsoscelesTriangle.md +docs/List.md +docs/Mammal.md +docs/MapTest.md +docs/MixedPropertiesAndAdditionalPropertiesClass.md +docs/Name.md +docs/NullableClass.md +docs/NullableShape.md +docs/NumberOnly.md +docs/ObjectWithDeprecatedFields.md docs/Order.md +docs/OuterComposite.md +docs/OuterEnum.md +docs/PSAnotherFakeApi.md +docs/PSDefaultApi.md +docs/PSFakeApi.md +docs/PSFakeClassnameTags123Api.md docs/PSPetApi.md docs/PSStoreApi.md docs/PSUserApi.md +docs/ParentPet.md docs/Pet.md +docs/PetWithRequiredTags.md +docs/Pig.md +docs/Quadrilateral.md +docs/QuadrilateralInterface.md +docs/ReadOnlyFirst.md +docs/Return.md +docs/ScaleneTriangle.md +docs/Shape.md +docs/ShapeInterface.md +docs/ShapeOrNull.md +docs/SimpleQuadrilateral.md +docs/SpecialModelName.md docs/Tag.md +docs/Triangle.md +docs/TriangleInterface.md docs/User.md +docs/Whale.md +docs/Zebra.md +src/PSPetstore/Api/PSAnotherFakeApi.ps1 +src/PSPetstore/Api/PSDefaultApi.ps1 +src/PSPetstore/Api/PSFakeApi.ps1 +src/PSPetstore/Api/PSFakeClassnameTags123Api.ps1 src/PSPetstore/Api/PSPetApi.ps1 src/PSPetstore/Api/PSStoreApi.ps1 src/PSPetstore/Api/PSUserApi.ps1 src/PSPetstore/Client/PSConfiguration.ps1 +src/PSPetstore/Model/AdditionalPropertiesClass.ps1 +src/PSPetstore/Model/Animal.ps1 src/PSPetstore/Model/ApiResponse.ps1 +src/PSPetstore/Model/Apple.ps1 +src/PSPetstore/Model/AppleReq.ps1 +src/PSPetstore/Model/ArrayOfArrayOfNumberOnly.ps1 +src/PSPetstore/Model/ArrayOfNumberOnly.ps1 +src/PSPetstore/Model/ArrayTest.ps1 +src/PSPetstore/Model/Banana.ps1 +src/PSPetstore/Model/BananaReq.ps1 +src/PSPetstore/Model/BasquePig.ps1 +src/PSPetstore/Model/Capitalization.ps1 +src/PSPetstore/Model/Cat.ps1 +src/PSPetstore/Model/CatAllOf.ps1 src/PSPetstore/Model/Category.ps1 +src/PSPetstore/Model/ClassModel.ps1 +src/PSPetstore/Model/Client.ps1 +src/PSPetstore/Model/ComplexQuadrilateral.ps1 +src/PSPetstore/Model/DanishPig.ps1 +src/PSPetstore/Model/DeprecatedObject.ps1 +src/PSPetstore/Model/Dog.ps1 +src/PSPetstore/Model/DogAllOf.ps1 +src/PSPetstore/Model/Drawing.ps1 +src/PSPetstore/Model/EnumArrays.ps1 +src/PSPetstore/Model/EnumTest.ps1 +src/PSPetstore/Model/EquilateralTriangle.ps1 +src/PSPetstore/Model/File.ps1 +src/PSPetstore/Model/FileSchemaTestClass.ps1 +src/PSPetstore/Model/Foo.ps1 +src/PSPetstore/Model/FormatTest.ps1 +src/PSPetstore/Model/Fruit.ps1 +src/PSPetstore/Model/FruitReq.ps1 +src/PSPetstore/Model/GmFruit.ps1 +src/PSPetstore/Model/GrandparentAnimal.ps1 +src/PSPetstore/Model/HasOnlyReadOnly.ps1 +src/PSPetstore/Model/HealthCheckResult.ps1 +src/PSPetstore/Model/InlineResponseDefault.ps1 +src/PSPetstore/Model/IsoscelesTriangle.ps1 +src/PSPetstore/Model/List.ps1 +src/PSPetstore/Model/Mammal.ps1 +src/PSPetstore/Model/MapTest.ps1 +src/PSPetstore/Model/MixedPropertiesAndAdditionalPropertiesClass.ps1 +src/PSPetstore/Model/Model200Response.ps1 +src/PSPetstore/Model/ModelReturn.ps1 +src/PSPetstore/Model/Name.ps1 +src/PSPetstore/Model/NullableClass.ps1 +src/PSPetstore/Model/NullableShape.ps1 +src/PSPetstore/Model/NumberOnly.ps1 +src/PSPetstore/Model/ObjectWithDeprecatedFields.ps1 src/PSPetstore/Model/Order.ps1 +src/PSPetstore/Model/OuterComposite.ps1 +src/PSPetstore/Model/OuterEnum.ps1 +src/PSPetstore/Model/ParentPet.ps1 src/PSPetstore/Model/Pet.ps1 +src/PSPetstore/Model/PetWithRequiredTags.ps1 +src/PSPetstore/Model/Pig.ps1 +src/PSPetstore/Model/Quadrilateral.ps1 +src/PSPetstore/Model/QuadrilateralInterface.ps1 +src/PSPetstore/Model/ReadOnlyFirst.ps1 +src/PSPetstore/Model/ScaleneTriangle.ps1 +src/PSPetstore/Model/Shape.ps1 +src/PSPetstore/Model/ShapeInterface.ps1 +src/PSPetstore/Model/ShapeOrNull.ps1 +src/PSPetstore/Model/SimpleQuadrilateral.ps1 +src/PSPetstore/Model/SpecialModelName.ps1 src/PSPetstore/Model/Tag.ps1 +src/PSPetstore/Model/Triangle.ps1 +src/PSPetstore/Model/TriangleInterface.ps1 src/PSPetstore/Model/User.ps1 +src/PSPetstore/Model/Whale.ps1 +src/PSPetstore/Model/Zebra.ps1 src/PSPetstore/PSPetstore.psm1 src/PSPetstore/Private/Get-CommonParameters.ps1 src/PSPetstore/Private/Out-DebugParameter.ps1 diff --git a/samples/client/petstore/powershell/Build.ps1 b/samples/client/petstore/powershell/Build.ps1 index dc4e005472d5..e15418c3aadf 100644 --- a/samples/client/petstore/powershell/Build.ps1 +++ b/samples/client/petstore/powershell/Build.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # diff --git a/samples/client/petstore/powershell/CIRunTest.ps1 b/samples/client/petstore/powershell/CIRunTest.ps1 new file mode 100644 index 000000000000..82aaf5ce46ca --- /dev/null +++ b/samples/client/petstore/powershell/CIRunTest.ps1 @@ -0,0 +1,14 @@ +# assuming the current directory is already set correctly +#cd samples\client\petstore\powershell\ +$ErrorActionPreference = "Stop" + +.\Build.ps1 + +Import-Module -Name '.\src\PSPetstore' + +$Result = Invoke-Pester -PassThru + +if ($Result.FailedCount -gt 0) { + $host.SetShouldExit($Result.FailedCount) + exit $Result.FailedCount +} diff --git a/samples/client/petstore/powershell/README.md b/samples/client/petstore/powershell/README.md index d394a82a0e91..f62e510dd220 100644 --- a/samples/client/petstore/powershell/README.md +++ b/samples/client/petstore/powershell/README.md @@ -1,6 +1,6 @@ # PSPetstore - the PowerShell module for the 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. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ This PowerShell module is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: @@ -55,6 +55,24 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*PSAnotherFakeApi* | [**Invoke-PS123TestSpecialTags**](docs/PSAnotherFakeApi.md#Invoke-PS123TestSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +*PSDefaultApi* | [**Invoke-PSFooGet**](docs/PSDefaultApi.md#Invoke-PSFooGet) | **GET** /foo | +*PSFakeApi* | [**Invoke-PSFakeHealthGet**](docs/PSFakeApi.md#Invoke-PSFakeHealthGet) | **GET** /fake/health | Health check endpoint +*PSFakeApi* | [**Invoke-PSFakeOuterBooleanSerialize**](docs/PSFakeApi.md#Invoke-PSFakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +*PSFakeApi* | [**Invoke-PSFakeOuterCompositeSerialize**](docs/PSFakeApi.md#Invoke-PSFakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +*PSFakeApi* | [**Invoke-PSFakeOuterNumberSerialize**](docs/PSFakeApi.md#Invoke-PSFakeOuterNumberSerialize) | **POST** /fake/outer/number | +*PSFakeApi* | [**Invoke-PSFakeOuterStringSerialize**](docs/PSFakeApi.md#Invoke-PSFakeOuterStringSerialize) | **POST** /fake/outer/string | +*PSFakeApi* | [**Get-PSArrayOfEnums**](docs/PSFakeApi.md#Get-PSArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums +*PSFakeApi* | [**Test-PSBodyWithFileSchema**](docs/PSFakeApi.md#Test-PSBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | +*PSFakeApi* | [**Test-PSBodyWithQueryParams**](docs/PSFakeApi.md#Test-PSBodyWithQueryParams) | **PUT** /fake/body-with-query-params | +*PSFakeApi* | [**Test-PSClientModel**](docs/PSFakeApi.md#Test-PSClientModel) | **PATCH** /fake | To test ""client"" model +*PSFakeApi* | [**Test-PSEndpointParameters**](docs/PSFakeApi.md#Test-PSEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*PSFakeApi* | [**Test-PSEnumParameters**](docs/PSFakeApi.md#Test-PSEnumParameters) | **GET** /fake | To test enum parameters +*PSFakeApi* | [**Test-PSGroupParameters**](docs/PSFakeApi.md#Test-PSGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*PSFakeApi* | [**Test-PSInlineAdditionalProperties**](docs/PSFakeApi.md#Test-PSInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*PSFakeApi* | [**Test-PSJsonFormData**](docs/PSFakeApi.md#Test-PSJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +*PSFakeApi* | [**Test-PSQueryParameterCollectionFormat**](docs/PSFakeApi.md#Test-PSQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | +*PSFakeClassnameTags123Api* | [**Test-PSClassname**](docs/PSFakeClassnameTags123Api.md#Test-PSClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PSPetApi* | [**Add-PSPet**](docs/PSPetApi.md#Add-PSPet) | **POST** /pet | Add a new pet to the store *PSPetApi* | [**Remove-Pet**](docs/PSPetApi.md#remove-pet) | **DELETE** /pet/{petId} | Deletes a pet *PSPetApi* | [**Find-PSPetsByStatus**](docs/PSPetApi.md#Find-PSPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status @@ -63,9 +81,10 @@ Class | Method | HTTP request | Description *PSPetApi* | [**Update-PSPet**](docs/PSPetApi.md#Update-PSPet) | **PUT** /pet | Update an existing pet *PSPetApi* | [**Update-PSPetWithForm**](docs/PSPetApi.md#Update-PSPetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data *PSPetApi* | [**Invoke-PSUploadFile**](docs/PSPetApi.md#Invoke-PSUploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image -*PSStoreApi* | [**Remove-PSOrder**](docs/PSStoreApi.md#Remove-PSOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*PSPetApi* | [**Invoke-PSUploadFileWithRequiredFile**](docs/PSPetApi.md#Invoke-PSUploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*PSStoreApi* | [**Remove-PSOrder**](docs/PSStoreApi.md#Remove-PSOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID *PSStoreApi* | [**Get-PSInventory**](docs/PSStoreApi.md#Get-PSInventory) | **GET** /store/inventory | Returns pet inventories by status -*PSStoreApi* | [**Get-PSOrderById**](docs/PSStoreApi.md#Get-PSOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*PSStoreApi* | [**Get-PSOrderById**](docs/PSStoreApi.md#Get-PSOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID *PSStoreApi* | [**Invoke-PSPlaceOrder**](docs/PSStoreApi.md#Invoke-PSPlaceOrder) | **POST** /store/order | Place an order for a pet *PSUserApi* | [**New-PSUser**](docs/PSUserApi.md#New-PSUser) | **POST** /user | Create user *PSUserApi* | [**New-PSUsersWithArrayInput**](docs/PSUserApi.md#New-PSUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array @@ -79,12 +98,77 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [PSPetstore/Model.AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [PSPetstore/Model.Animal](docs/Animal.md) - [PSPetstore/Model.ApiResponse](docs/ApiResponse.md) + - [PSPetstore/Model.Apple](docs/Apple.md) + - [PSPetstore/Model.AppleReq](docs/AppleReq.md) + - [PSPetstore/Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [PSPetstore/Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [PSPetstore/Model.ArrayTest](docs/ArrayTest.md) + - [PSPetstore/Model.Banana](docs/Banana.md) + - [PSPetstore/Model.BananaReq](docs/BananaReq.md) + - [PSPetstore/Model.BasquePig](docs/BasquePig.md) + - [PSPetstore/Model.Capitalization](docs/Capitalization.md) + - [PSPetstore/Model.Cat](docs/Cat.md) + - [PSPetstore/Model.CatAllOf](docs/CatAllOf.md) - [PSPetstore/Model.Category](docs/Category.md) + - [PSPetstore/Model.ClassModel](docs/ClassModel.md) + - [PSPetstore/Model.Client](docs/Client.md) + - [PSPetstore/Model.ComplexQuadrilateral](docs/ComplexQuadrilateral.md) + - [PSPetstore/Model.DanishPig](docs/DanishPig.md) + - [PSPetstore/Model.DeprecatedObject](docs/DeprecatedObject.md) + - [PSPetstore/Model.Dog](docs/Dog.md) + - [PSPetstore/Model.DogAllOf](docs/DogAllOf.md) + - [PSPetstore/Model.Drawing](docs/Drawing.md) + - [PSPetstore/Model.EnumArrays](docs/EnumArrays.md) + - [PSPetstore/Model.EnumTest](docs/EnumTest.md) + - [PSPetstore/Model.EquilateralTriangle](docs/EquilateralTriangle.md) + - [PSPetstore/Model.File](docs/File.md) + - [PSPetstore/Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [PSPetstore/Model.Foo](docs/Foo.md) + - [PSPetstore/Model.FormatTest](docs/FormatTest.md) + - [PSPetstore/Model.Fruit](docs/Fruit.md) + - [PSPetstore/Model.FruitReq](docs/FruitReq.md) + - [PSPetstore/Model.GmFruit](docs/GmFruit.md) + - [PSPetstore/Model.GrandparentAnimal](docs/GrandparentAnimal.md) + - [PSPetstore/Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [PSPetstore/Model.HealthCheckResult](docs/HealthCheckResult.md) + - [PSPetstore/Model.InlineResponseDefault](docs/InlineResponseDefault.md) + - [PSPetstore/Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) + - [PSPetstore/Model.List](docs/List.md) + - [PSPetstore/Model.Mammal](docs/Mammal.md) + - [PSPetstore/Model.MapTest](docs/MapTest.md) + - [PSPetstore/Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [PSPetstore/Model.Model200Response](docs/Model200Response.md) + - [PSPetstore/Model.ModelReturn](docs/ModelReturn.md) + - [PSPetstore/Model.Name](docs/Name.md) + - [PSPetstore/Model.NullableClass](docs/NullableClass.md) + - [PSPetstore/Model.NullableShape](docs/NullableShape.md) + - [PSPetstore/Model.NumberOnly](docs/NumberOnly.md) + - [PSPetstore/Model.ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md) - [PSPetstore/Model.Order](docs/Order.md) + - [PSPetstore/Model.OuterComposite](docs/OuterComposite.md) + - [PSPetstore/Model.OuterEnum](docs/OuterEnum.md) + - [PSPetstore/Model.ParentPet](docs/ParentPet.md) - [PSPetstore/Model.Pet](docs/Pet.md) + - [PSPetstore/Model.PetWithRequiredTags](docs/PetWithRequiredTags.md) + - [PSPetstore/Model.Pig](docs/Pig.md) + - [PSPetstore/Model.Quadrilateral](docs/Quadrilateral.md) + - [PSPetstore/Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) + - [PSPetstore/Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [PSPetstore/Model.ScaleneTriangle](docs/ScaleneTriangle.md) + - [PSPetstore/Model.Shape](docs/Shape.md) + - [PSPetstore/Model.ShapeInterface](docs/ShapeInterface.md) + - [PSPetstore/Model.ShapeOrNull](docs/ShapeOrNull.md) + - [PSPetstore/Model.SimpleQuadrilateral](docs/SimpleQuadrilateral.md) + - [PSPetstore/Model.SpecialModelName](docs/SpecialModelName.md) - [PSPetstore/Model.Tag](docs/Tag.md) + - [PSPetstore/Model.Triangle](docs/Triangle.md) + - [PSPetstore/Model.TriangleInterface](docs/TriangleInterface.md) - [PSPetstore/Model.User](docs/User.md) + - [PSPetstore/Model.Whale](docs/Whale.md) + - [PSPetstore/Model.Zebra](docs/Zebra.md) ## Documentation for Authorization @@ -98,12 +182,30 @@ Class | Method | HTTP request | Description - **Location**: HTTP header -### auth_cookie +### api_key_query - **Type**: API key -- **API key parameter name**: AUTH_KEY -- **Location**: +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### bearer_test + + +- **Type**: HTTP basic authentication + + +### http_basic_test + + +- **Type**: HTTP basic authentication + + +### http_signature_test + + +- **Type**: HTTP basic authentication ### petstore_auth diff --git a/samples/client/petstore/powershell/appveyor.yml b/samples/client/petstore/powershell/appveyor.yml index 86b98d394b5c..49a524319c08 100644 --- a/samples/client/petstore/powershell/appveyor.yml +++ b/samples/client/petstore/powershell/appveyor.yml @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # diff --git a/samples/client/petstore/powershell/docs/200Response.md b/samples/client/petstore/powershell/docs/200Response.md new file mode 100644 index 000000000000..b76a7e3f4c2a --- /dev/null +++ b/samples/client/petstore/powershell/docs/200Response.md @@ -0,0 +1,23 @@ +# Model200Response +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **Int32** | | [optional] +**Class** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$Model200Response = Initialize-PSPetstoreModel200Response -Name null ` + -Class null +``` + +- Convert the resource to JSON +```powershell +$Model200Response | ConvertTo-JSON +``` + +[[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/powershell/docs/AdditionalPropertiesClass.md b/samples/client/petstore/powershell/docs/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..6019343625fa --- /dev/null +++ b/samples/client/petstore/powershell/docs/AdditionalPropertiesClass.md @@ -0,0 +1,35 @@ +# AdditionalPropertiesClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MapProperty** | **System.Collections.Hashtable** | | [optional] +**MapOfMapProperty** | [**System.Collections.Hashtable**](Map.md) | | [optional] +**Anytype1** | [**AnyType**](.md) | | [optional] +**MapWithUndeclaredPropertiesAnytype1** | [**SystemCollectionsHashtable**](.md) | | [optional] +**MapWithUndeclaredPropertiesAnytype2** | [**SystemCollectionsHashtable**](.md) | | [optional] +**MapWithUndeclaredPropertiesAnytype3** | [**System.Collections.Hashtable**](AnyType.md) | | [optional] +**EmptyMap** | [**SystemCollectionsHashtable**](.md) | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] +**MapWithUndeclaredPropertiesString** | **System.Collections.Hashtable** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$AdditionalPropertiesClass = Initialize-PSPetstoreAdditionalPropertiesClass -MapProperty null ` + -MapOfMapProperty null ` + -Anytype1 null ` + -MapWithUndeclaredPropertiesAnytype1 null ` + -MapWithUndeclaredPropertiesAnytype2 null ` + -MapWithUndeclaredPropertiesAnytype3 null ` + -EmptyMap null ` + -MapWithUndeclaredPropertiesString null +``` + +- Convert the resource to JSON +```powershell +$AdditionalPropertiesClass | ConvertTo-JSON +``` + +[[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/powershell/docs/Animal.md b/samples/client/petstore/powershell/docs/Animal.md new file mode 100644 index 000000000000..58df67eab7df --- /dev/null +++ b/samples/client/petstore/powershell/docs/Animal.md @@ -0,0 +1,23 @@ +# Animal +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **String** | | +**Color** | **String** | | [optional] [default to "red"] + +## Examples + +- Prepare the resource +```powershell +$Animal = Initialize-PSPetstoreAnimal -ClassName null ` + -Color null +``` + +- Convert the resource to JSON +```powershell +$Animal | ConvertTo-JSON +``` + +[[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/powershell/docs/Apple.md b/samples/client/petstore/powershell/docs/Apple.md new file mode 100644 index 000000000000..9300bd149eca --- /dev/null +++ b/samples/client/petstore/powershell/docs/Apple.md @@ -0,0 +1,23 @@ +# Apple +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cultivar** | **String** | | [optional] +**Origin** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$Apple = Initialize-PSPetstoreApple -Cultivar null ` + -Origin null +``` + +- Convert the resource to JSON +```powershell +$Apple | ConvertTo-JSON +``` + +[[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/powershell/docs/AppleReq.md b/samples/client/petstore/powershell/docs/AppleReq.md new file mode 100644 index 000000000000..d6450add0c3d --- /dev/null +++ b/samples/client/petstore/powershell/docs/AppleReq.md @@ -0,0 +1,23 @@ +# AppleReq +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cultivar** | **String** | | +**Mealy** | **Boolean** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$AppleReq = Initialize-PSPetstoreAppleReq -Cultivar null ` + -Mealy null +``` + +- Convert the resource to JSON +```powershell +$AppleReq | ConvertTo-JSON +``` + +[[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/powershell/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/powershell/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..c09ec94f47cc --- /dev/null +++ b/samples/client/petstore/powershell/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,21 @@ +# ArrayOfArrayOfNumberOnly +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayNumber** | [**Decimal[][]**](Array.md) | | [optional] + +## Examples + +- Prepare the resource +```powershell +$ArrayOfArrayOfNumberOnly = Initialize-PSPetstoreArrayOfArrayOfNumberOnly -ArrayArrayNumber null +``` + +- Convert the resource to JSON +```powershell +$ArrayOfArrayOfNumberOnly | ConvertTo-JSON +``` + +[[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/powershell/docs/ArrayOfNumberOnly.md b/samples/client/petstore/powershell/docs/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..d9ecadf562d6 --- /dev/null +++ b/samples/client/petstore/powershell/docs/ArrayOfNumberOnly.md @@ -0,0 +1,21 @@ +# ArrayOfNumberOnly +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayNumber** | **Decimal[]** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$ArrayOfNumberOnly = Initialize-PSPetstoreArrayOfNumberOnly -ArrayNumber null +``` + +- Convert the resource to JSON +```powershell +$ArrayOfNumberOnly | ConvertTo-JSON +``` + +[[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/powershell/docs/ArrayTest.md b/samples/client/petstore/powershell/docs/ArrayTest.md new file mode 100644 index 000000000000..d95b602b96c8 --- /dev/null +++ b/samples/client/petstore/powershell/docs/ArrayTest.md @@ -0,0 +1,25 @@ +# ArrayTest +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayOfString** | **String[]** | | [optional] +**ArrayArrayOfInteger** | [**Int64[][]**](Array.md) | | [optional] +**ArrayArrayOfModel** | [**ReadOnlyFirst[][]**](Array.md) | | [optional] + +## Examples + +- Prepare the resource +```powershell +$ArrayTest = Initialize-PSPetstoreArrayTest -ArrayOfString null ` + -ArrayArrayOfInteger null ` + -ArrayArrayOfModel null +``` + +- Convert the resource to JSON +```powershell +$ArrayTest | ConvertTo-JSON +``` + +[[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/powershell/docs/Banana.md b/samples/client/petstore/powershell/docs/Banana.md new file mode 100644 index 000000000000..db1064bfb605 --- /dev/null +++ b/samples/client/petstore/powershell/docs/Banana.md @@ -0,0 +1,21 @@ +# Banana +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LengthCm** | **Decimal** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$Banana = Initialize-PSPetstoreBanana -LengthCm null +``` + +- Convert the resource to JSON +```powershell +$Banana | ConvertTo-JSON +``` + +[[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/powershell/docs/BananaReq.md b/samples/client/petstore/powershell/docs/BananaReq.md new file mode 100644 index 000000000000..88edcf57f200 --- /dev/null +++ b/samples/client/petstore/powershell/docs/BananaReq.md @@ -0,0 +1,23 @@ +# BananaReq +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LengthCm** | **Decimal** | | +**Sweet** | **Boolean** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$BananaReq = Initialize-PSPetstoreBananaReq -LengthCm null ` + -Sweet null +``` + +- Convert the resource to JSON +```powershell +$BananaReq | ConvertTo-JSON +``` + +[[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/powershell/docs/BasquePig.md b/samples/client/petstore/powershell/docs/BasquePig.md new file mode 100644 index 000000000000..e0bb8c95b80e --- /dev/null +++ b/samples/client/petstore/powershell/docs/BasquePig.md @@ -0,0 +1,21 @@ +# BasquePig +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$BasquePig = Initialize-PSPetstoreBasquePig -ClassName null +``` + +- Convert the resource to JSON +```powershell +$BasquePig | ConvertTo-JSON +``` + +[[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/powershell/docs/Capitalization.md b/samples/client/petstore/powershell/docs/Capitalization.md new file mode 100644 index 000000000000..dbd1d1f92de3 --- /dev/null +++ b/samples/client/petstore/powershell/docs/Capitalization.md @@ -0,0 +1,31 @@ +# Capitalization +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SmallCamel** | **String** | | [optional] +**CapitalCamel** | **String** | | [optional] +**SmallSnake** | **String** | | [optional] +**CapitalSnake** | **String** | | [optional] +**SCAETHFlowPoints** | **String** | | [optional] +**ATTNAME** | **String** | Name of the pet | [optional] + +## Examples + +- Prepare the resource +```powershell +$Capitalization = Initialize-PSPetstoreCapitalization -SmallCamel null ` + -CapitalCamel null ` + -SmallSnake null ` + -CapitalSnake null ` + -SCAETHFlowPoints null ` + -ATTNAME null +``` + +- Convert the resource to JSON +```powershell +$Capitalization | ConvertTo-JSON +``` + +[[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/powershell/docs/Cat.md b/samples/client/petstore/powershell/docs/Cat.md new file mode 100644 index 000000000000..5acf8c5186a7 --- /dev/null +++ b/samples/client/petstore/powershell/docs/Cat.md @@ -0,0 +1,25 @@ +# Cat +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **String** | | +**Color** | **String** | | [optional] [default to "red"] +**Declawed** | **Boolean** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$Cat = Initialize-PSPetstoreCat -ClassName null ` + -Color null ` + -Declawed null +``` + +- Convert the resource to JSON +```powershell +$Cat | ConvertTo-JSON +``` + +[[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/powershell/docs/CatAllOf.md b/samples/client/petstore/powershell/docs/CatAllOf.md new file mode 100644 index 000000000000..451db0fa20b7 --- /dev/null +++ b/samples/client/petstore/powershell/docs/CatAllOf.md @@ -0,0 +1,21 @@ +# CatAllOf +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Declawed** | **Boolean** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$CatAllOf = Initialize-PSPetstoreCatAllOf -Declawed null +``` + +- Convert the resource to JSON +```powershell +$CatAllOf | ConvertTo-JSON +``` + +[[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/powershell/docs/Category.md b/samples/client/petstore/powershell/docs/Category.md index 96644698838c..01bb6682755c 100644 --- a/samples/client/petstore/powershell/docs/Category.md +++ b/samples/client/petstore/powershell/docs/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **Int64** | | [optional] -**Name** | **String** | | [optional] +**Name** | **String** | | [default to "default-name"] ## Examples diff --git a/samples/client/petstore/powershell/docs/ClassModel.md b/samples/client/petstore/powershell/docs/ClassModel.md new file mode 100644 index 000000000000..c5735d43e7d4 --- /dev/null +++ b/samples/client/petstore/powershell/docs/ClassModel.md @@ -0,0 +1,21 @@ +# ClassModel +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Class** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$ClassModel = Initialize-PSPetstoreClassModel -Class null +``` + +- Convert the resource to JSON +```powershell +$ClassModel | ConvertTo-JSON +``` + +[[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/powershell/docs/Client.md b/samples/client/petstore/powershell/docs/Client.md new file mode 100644 index 000000000000..a447197d49c8 --- /dev/null +++ b/samples/client/petstore/powershell/docs/Client.md @@ -0,0 +1,21 @@ +# Client +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Client** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$Client = Initialize-PSPetstoreClient -Client null +``` + +- Convert the resource to JSON +```powershell +$Client | ConvertTo-JSON +``` + +[[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/powershell/docs/ComplexQuadrilateral.md b/samples/client/petstore/powershell/docs/ComplexQuadrilateral.md new file mode 100644 index 000000000000..c34b2f9941a6 --- /dev/null +++ b/samples/client/petstore/powershell/docs/ComplexQuadrilateral.md @@ -0,0 +1,23 @@ +# ComplexQuadrilateral +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **String** | | +**QuadrilateralType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$ComplexQuadrilateral = Initialize-PSPetstoreComplexQuadrilateral -ShapeType null ` + -QuadrilateralType null +``` + +- Convert the resource to JSON +```powershell +$ComplexQuadrilateral | ConvertTo-JSON +``` + +[[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/powershell/docs/DanishPig.md b/samples/client/petstore/powershell/docs/DanishPig.md new file mode 100644 index 000000000000..f1e5f0ebeafa --- /dev/null +++ b/samples/client/petstore/powershell/docs/DanishPig.md @@ -0,0 +1,21 @@ +# DanishPig +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$DanishPig = Initialize-PSPetstoreDanishPig -ClassName null +``` + +- Convert the resource to JSON +```powershell +$DanishPig | ConvertTo-JSON +``` + +[[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/powershell/docs/DeprecatedObject.md b/samples/client/petstore/powershell/docs/DeprecatedObject.md new file mode 100644 index 000000000000..b0cb2c030aa0 --- /dev/null +++ b/samples/client/petstore/powershell/docs/DeprecatedObject.md @@ -0,0 +1,21 @@ +# DeprecatedObject +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$DeprecatedObject = Initialize-PSPetstoreDeprecatedObject -Name null +``` + +- Convert the resource to JSON +```powershell +$DeprecatedObject | ConvertTo-JSON +``` + +[[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/powershell/docs/Dog.md b/samples/client/petstore/powershell/docs/Dog.md new file mode 100644 index 000000000000..fb0a4f48f37b --- /dev/null +++ b/samples/client/petstore/powershell/docs/Dog.md @@ -0,0 +1,25 @@ +# Dog +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **String** | | +**Color** | **String** | | [optional] [default to "red"] +**Breed** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$Dog = Initialize-PSPetstoreDog -ClassName null ` + -Color null ` + -Breed null +``` + +- Convert the resource to JSON +```powershell +$Dog | ConvertTo-JSON +``` + +[[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/powershell/docs/DogAllOf.md b/samples/client/petstore/powershell/docs/DogAllOf.md new file mode 100644 index 000000000000..73337ad7405a --- /dev/null +++ b/samples/client/petstore/powershell/docs/DogAllOf.md @@ -0,0 +1,21 @@ +# DogAllOf +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Breed** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$DogAllOf = Initialize-PSPetstoreDogAllOf -Breed null +``` + +- Convert the resource to JSON +```powershell +$DogAllOf | ConvertTo-JSON +``` + +[[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/powershell/docs/Drawing.md b/samples/client/petstore/powershell/docs/Drawing.md new file mode 100644 index 000000000000..362fba5054de --- /dev/null +++ b/samples/client/petstore/powershell/docs/Drawing.md @@ -0,0 +1,27 @@ +# Drawing +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MainShape** | [**Shape**](Shape.md) | | [optional] +**ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] +**NullableShape** | [**NullableShape**](NullableShape.md) | | [optional] +**Shapes** | [**Shape[]**](Shape.md) | | [optional] + +## Examples + +- Prepare the resource +```powershell +$Drawing = Initialize-PSPetstoreDrawing -MainShape null ` + -ShapeOrNull null ` + -NullableShape null ` + -Shapes null +``` + +- Convert the resource to JSON +```powershell +$Drawing | ConvertTo-JSON +``` + +[[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/powershell/docs/EnumArrays.md b/samples/client/petstore/powershell/docs/EnumArrays.md new file mode 100644 index 000000000000..9ba5f540f9e5 --- /dev/null +++ b/samples/client/petstore/powershell/docs/EnumArrays.md @@ -0,0 +1,23 @@ +# EnumArrays +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustSymbol** | **String** | | [optional] +**ArrayEnum** | **String[]** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$EnumArrays = Initialize-PSPetstoreEnumArrays -JustSymbol null ` + -ArrayEnum null +``` + +- Convert the resource to JSON +```powershell +$EnumArrays | ConvertTo-JSON +``` + +[[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/powershell/docs/EnumClass.md b/samples/client/petstore/powershell/docs/EnumClass.md new file mode 100644 index 000000000000..a928ad7c3bf6 --- /dev/null +++ b/samples/client/petstore/powershell/docs/EnumClass.md @@ -0,0 +1,20 @@ +# EnumClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Examples + +- Prepare the resource +```powershell +$EnumClass = Initialize-PSPetstoreEnumClass +``` + +- Convert the resource to JSON +```powershell +$EnumClass | ConvertTo-JSON +``` + +[[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/powershell/docs/EnumTest.md b/samples/client/petstore/powershell/docs/EnumTest.md new file mode 100644 index 000000000000..25d92ed0225d --- /dev/null +++ b/samples/client/petstore/powershell/docs/EnumTest.md @@ -0,0 +1,31 @@ +# EnumTest +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumString** | **String** | | [optional] +**EnumStringRequired** | **String** | | +**EnumInteger** | **Int32** | | [optional] +**EnumIntegerOnly** | **Int32** | | [optional] +**EnumNumber** | **Double** | | [optional] +**OuterEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] + +## Examples + +- Prepare the resource +```powershell +$EnumTest = Initialize-PSPetstoreEnumTest -EnumString null ` + -EnumStringRequired null ` + -EnumInteger null ` + -EnumIntegerOnly null ` + -EnumNumber null ` + -OuterEnum null +``` + +- Convert the resource to JSON +```powershell +$EnumTest | ConvertTo-JSON +``` + +[[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/powershell/docs/EquilateralTriangle.md b/samples/client/petstore/powershell/docs/EquilateralTriangle.md new file mode 100644 index 000000000000..aeb38986c1ba --- /dev/null +++ b/samples/client/petstore/powershell/docs/EquilateralTriangle.md @@ -0,0 +1,23 @@ +# EquilateralTriangle +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **String** | | +**TriangleType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$EquilateralTriangle = Initialize-PSPetstoreEquilateralTriangle -ShapeType null ` + -TriangleType null +``` + +- Convert the resource to JSON +```powershell +$EquilateralTriangle | ConvertTo-JSON +``` + +[[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/powershell/docs/File.md b/samples/client/petstore/powershell/docs/File.md new file mode 100644 index 000000000000..09e1dd3ed8d1 --- /dev/null +++ b/samples/client/petstore/powershell/docs/File.md @@ -0,0 +1,21 @@ +# File +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SourceURI** | **String** | Test capitalization | [optional] + +## Examples + +- Prepare the resource +```powershell +$File = Initialize-PSPetstoreFile -SourceURI null +``` + +- Convert the resource to JSON +```powershell +$File | ConvertTo-JSON +``` + +[[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/powershell/docs/FileSchemaTestClass.md b/samples/client/petstore/powershell/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..c350eece6edc --- /dev/null +++ b/samples/client/petstore/powershell/docs/FileSchemaTestClass.md @@ -0,0 +1,23 @@ +# FileSchemaTestClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | [**File**](File.md) | | [optional] +**Files** | [**File[]**](File.md) | | [optional] + +## Examples + +- Prepare the resource +```powershell +$FileSchemaTestClass = Initialize-PSPetstoreFileSchemaTestClass -File null ` + -Files null +``` + +- Convert the resource to JSON +```powershell +$FileSchemaTestClass | ConvertTo-JSON +``` + +[[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/powershell/docs/Foo.md b/samples/client/petstore/powershell/docs/Foo.md new file mode 100644 index 000000000000..ad152ea32714 --- /dev/null +++ b/samples/client/petstore/powershell/docs/Foo.md @@ -0,0 +1,21 @@ +# Foo +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **String** | | [optional] [default to "bar"] + +## Examples + +- Prepare the resource +```powershell +$Foo = Initialize-PSPetstoreFoo -Bar null +``` + +- Convert the resource to JSON +```powershell +$Foo | ConvertTo-JSON +``` + +[[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/powershell/docs/FormatTest.md b/samples/client/petstore/powershell/docs/FormatTest.md new file mode 100644 index 000000000000..f413641a5eb0 --- /dev/null +++ b/samples/client/petstore/powershell/docs/FormatTest.md @@ -0,0 +1,51 @@ +# FormatTest +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Integer** | **Int32** | | [optional] +**Int32** | **Int32** | | [optional] +**Int64** | **Int64** | | [optional] +**Number** | **Decimal** | | +**Float** | **Double** | | [optional] +**Double** | **Double** | | [optional] +**Decimal** | **Decimal** | | [optional] +**String** | **String** | | [optional] +**Byte** | [**SystemByte**](SystemByte.md) | | +**Binary** | **System.IO.FileInfo** | | [optional] +**Date** | **System.DateTime** | | +**DateTime** | **System.DateTime** | | [optional] +**Uuid** | **String** | | [optional] +**Password** | **String** | | +**PatternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**PatternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] + +## Examples + +- Prepare the resource +```powershell +$FormatTest = Initialize-PSPetstoreFormatTest -Integer null ` + -Int32 null ` + -Int64 null ` + -Number null ` + -Float null ` + -Double null ` + -Decimal null ` + -String null ` + -Byte null ` + -Binary null ` + -Date Sun Feb 02 00:00:00 UTC 2020 ` + -DateTime 2007-12-03T10:15:30+01:00 ` + -Uuid 72f98069-206d-4f12-9f12-3d1e525a8e84 ` + -Password null ` + -PatternWithDigits null ` + -PatternWithDigitsAndDelimiter null +``` + +- Convert the resource to JSON +```powershell +$FormatTest | ConvertTo-JSON +``` + +[[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/powershell/docs/Fruit.md b/samples/client/petstore/powershell/docs/Fruit.md new file mode 100644 index 000000000000..2a6716b42f75 --- /dev/null +++ b/samples/client/petstore/powershell/docs/Fruit.md @@ -0,0 +1,27 @@ +# Fruit +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | **String** | | [optional] +**Cultivar** | **String** | | [optional] +**Origin** | **String** | | [optional] +**LengthCm** | **Decimal** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$Fruit = Initialize-PSPetstoreFruit -Color null ` + -Cultivar null ` + -Origin null ` + -LengthCm null +``` + +- Convert the resource to JSON +```powershell +$Fruit | ConvertTo-JSON +``` + +[[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/powershell/docs/FruitReq.md b/samples/client/petstore/powershell/docs/FruitReq.md new file mode 100644 index 000000000000..d8fcd89ee5e1 --- /dev/null +++ b/samples/client/petstore/powershell/docs/FruitReq.md @@ -0,0 +1,27 @@ +# FruitReq +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cultivar** | **String** | | +**Mealy** | **Boolean** | | [optional] +**LengthCm** | **Decimal** | | +**Sweet** | **Boolean** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$FruitReq = Initialize-PSPetstoreFruitReq -Cultivar null ` + -Mealy null ` + -LengthCm null ` + -Sweet null +``` + +- Convert the resource to JSON +```powershell +$FruitReq | ConvertTo-JSON +``` + +[[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/powershell/docs/GmFruit.md b/samples/client/petstore/powershell/docs/GmFruit.md new file mode 100644 index 000000000000..db0e1e6476bb --- /dev/null +++ b/samples/client/petstore/powershell/docs/GmFruit.md @@ -0,0 +1,27 @@ +# GmFruit +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | **String** | | [optional] +**Cultivar** | **String** | | [optional] +**Origin** | **String** | | [optional] +**LengthCm** | **Decimal** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$GmFruit = Initialize-PSPetstoreGmFruit -Color null ` + -Cultivar null ` + -Origin null ` + -LengthCm null +``` + +- Convert the resource to JSON +```powershell +$GmFruit | ConvertTo-JSON +``` + +[[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/powershell/docs/GrandparentAnimal.md b/samples/client/petstore/powershell/docs/GrandparentAnimal.md new file mode 100644 index 000000000000..c4d0d92efa14 --- /dev/null +++ b/samples/client/petstore/powershell/docs/GrandparentAnimal.md @@ -0,0 +1,21 @@ +# GrandparentAnimal +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PetType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$GrandparentAnimal = Initialize-PSPetstoreGrandparentAnimal -PetType null +``` + +- Convert the resource to JSON +```powershell +$GrandparentAnimal | ConvertTo-JSON +``` + +[[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/powershell/docs/HasOnlyReadOnly.md b/samples/client/petstore/powershell/docs/HasOnlyReadOnly.md new file mode 100644 index 000000000000..b227658de7e4 --- /dev/null +++ b/samples/client/petstore/powershell/docs/HasOnlyReadOnly.md @@ -0,0 +1,23 @@ +# HasOnlyReadOnly +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **String** | | [optional] [readonly] +**Foo** | **String** | | [optional] [readonly] + +## Examples + +- Prepare the resource +```powershell +$HasOnlyReadOnly = Initialize-PSPetstoreHasOnlyReadOnly -Bar null ` + -Foo null +``` + +- Convert the resource to JSON +```powershell +$HasOnlyReadOnly | ConvertTo-JSON +``` + +[[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/powershell/docs/HealthCheckResult.md b/samples/client/petstore/powershell/docs/HealthCheckResult.md new file mode 100644 index 000000000000..beb1d70722c5 --- /dev/null +++ b/samples/client/petstore/powershell/docs/HealthCheckResult.md @@ -0,0 +1,21 @@ +# HealthCheckResult +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**NullableMessage** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$HealthCheckResult = Initialize-PSPetstoreHealthCheckResult -NullableMessage null +``` + +- Convert the resource to JSON +```powershell +$HealthCheckResult | ConvertTo-JSON +``` + +[[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/powershell/docs/InlineResponseDefault.md b/samples/client/petstore/powershell/docs/InlineResponseDefault.md new file mode 100644 index 000000000000..3169148a9324 --- /dev/null +++ b/samples/client/petstore/powershell/docs/InlineResponseDefault.md @@ -0,0 +1,21 @@ +# InlineResponseDefault +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [optional] + +## Examples + +- Prepare the resource +```powershell +$InlineResponseDefault = Initialize-PSPetstoreInlineResponseDefault -String null +``` + +- Convert the resource to JSON +```powershell +$InlineResponseDefault | ConvertTo-JSON +``` + +[[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/powershell/docs/IsoscelesTriangle.md b/samples/client/petstore/powershell/docs/IsoscelesTriangle.md new file mode 100644 index 000000000000..7f71d9c439aa --- /dev/null +++ b/samples/client/petstore/powershell/docs/IsoscelesTriangle.md @@ -0,0 +1,23 @@ +# IsoscelesTriangle +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **String** | | +**TriangleType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$IsoscelesTriangle = Initialize-PSPetstoreIsoscelesTriangle -ShapeType null ` + -TriangleType null +``` + +- Convert the resource to JSON +```powershell +$IsoscelesTriangle | ConvertTo-JSON +``` + +[[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/powershell/docs/List.md b/samples/client/petstore/powershell/docs/List.md new file mode 100644 index 000000000000..625a406020a1 --- /dev/null +++ b/samples/client/petstore/powershell/docs/List.md @@ -0,0 +1,21 @@ +# List +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Var123List** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$List = Initialize-PSPetstoreList -Var123List null +``` + +- Convert the resource to JSON +```powershell +$List | ConvertTo-JSON +``` + +[[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/powershell/docs/Mammal.md b/samples/client/petstore/powershell/docs/Mammal.md new file mode 100644 index 000000000000..a3ee83c488ae --- /dev/null +++ b/samples/client/petstore/powershell/docs/Mammal.md @@ -0,0 +1,27 @@ +# Mammal +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**HasBaleen** | **Boolean** | | [optional] +**HasTeeth** | **Boolean** | | [optional] +**ClassName** | **String** | | +**Type** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$Mammal = Initialize-PSPetstoreMammal -HasBaleen null ` + -HasTeeth null ` + -ClassName null ` + -Type null +``` + +- Convert the resource to JSON +```powershell +$Mammal | ConvertTo-JSON +``` + +[[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/powershell/docs/MapTest.md b/samples/client/petstore/powershell/docs/MapTest.md new file mode 100644 index 000000000000..8ac5b4e5321d --- /dev/null +++ b/samples/client/petstore/powershell/docs/MapTest.md @@ -0,0 +1,27 @@ +# MapTest +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MapMapOfString** | [**System.Collections.Hashtable**](Map.md) | | [optional] +**MapOfEnumString** | **System.Collections.Hashtable** | | [optional] +**DirectMap** | **System.Collections.Hashtable** | | [optional] +**IndirectMap** | **System.Collections.Hashtable** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$MapTest = Initialize-PSPetstoreMapTest -MapMapOfString null ` + -MapOfEnumString null ` + -DirectMap null ` + -IndirectMap null +``` + +- Convert the resource to JSON +```powershell +$MapTest | ConvertTo-JSON +``` + +[[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/powershell/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/powershell/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..d6ae68845b8a --- /dev/null +++ b/samples/client/petstore/powershell/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,25 @@ +# MixedPropertiesAndAdditionalPropertiesClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Uuid** | **String** | | [optional] +**DateTime** | **System.DateTime** | | [optional] +**Map** | [**System.Collections.Hashtable**](Animal.md) | | [optional] + +## Examples + +- Prepare the resource +```powershell +$MixedPropertiesAndAdditionalPropertiesClass = Initialize-PSPetstoreMixedPropertiesAndAdditionalPropertiesClass -Uuid null ` + -DateTime null ` + -Map null +``` + +- Convert the resource to JSON +```powershell +$MixedPropertiesAndAdditionalPropertiesClass | ConvertTo-JSON +``` + +[[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/powershell/docs/Name.md b/samples/client/petstore/powershell/docs/Name.md new file mode 100644 index 000000000000..fdae841de883 --- /dev/null +++ b/samples/client/petstore/powershell/docs/Name.md @@ -0,0 +1,27 @@ +# Name +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **Int32** | | +**SnakeCase** | **Int32** | | [optional] [readonly] +**Property** | **String** | | [optional] +**Var123Number** | **Int32** | | [optional] [readonly] + +## Examples + +- Prepare the resource +```powershell +$Name = Initialize-PSPetstoreName -Name null ` + -SnakeCase null ` + -Property null ` + -Var123Number null +``` + +- Convert the resource to JSON +```powershell +$Name | ConvertTo-JSON +``` + +[[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/powershell/docs/NullableClass.md b/samples/client/petstore/powershell/docs/NullableClass.md new file mode 100644 index 000000000000..e7c5230140e6 --- /dev/null +++ b/samples/client/petstore/powershell/docs/NullableClass.md @@ -0,0 +1,43 @@ +# NullableClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**IntegerProp** | **Int32** | | [optional] +**NumberProp** | **Decimal** | | [optional] +**BooleanProp** | **Boolean** | | [optional] +**StringProp** | **String** | | [optional] +**DateProp** | **System.DateTime** | | [optional] +**DatetimeProp** | **System.DateTime** | | [optional] +**ArrayNullableProp** | [**SystemCollectionsHashtable[]**](SystemCollectionsHashtable.md) | | [optional] +**ArrayAndItemsNullableProp** | [**SystemCollectionsHashtable[]**](SystemCollectionsHashtable.md) | | [optional] +**ArrayItemsNullable** | [**SystemCollectionsHashtable[]**](SystemCollectionsHashtable.md) | | [optional] +**ObjectNullableProp** | [**System.Collections.Hashtable**](SystemCollectionsHashtable.md) | | [optional] +**ObjectAndItemsNullableProp** | [**System.Collections.Hashtable**](SystemCollectionsHashtable.md) | | [optional] +**ObjectItemsNullable** | [**System.Collections.Hashtable**](SystemCollectionsHashtable.md) | | [optional] + +## Examples + +- Prepare the resource +```powershell +$NullableClass = Initialize-PSPetstoreNullableClass -IntegerProp null ` + -NumberProp null ` + -BooleanProp null ` + -StringProp null ` + -DateProp null ` + -DatetimeProp null ` + -ArrayNullableProp null ` + -ArrayAndItemsNullableProp null ` + -ArrayItemsNullable null ` + -ObjectNullableProp null ` + -ObjectAndItemsNullableProp null ` + -ObjectItemsNullable null +``` + +- Convert the resource to JSON +```powershell +$NullableClass | ConvertTo-JSON +``` + +[[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/powershell/docs/NullableShape.md b/samples/client/petstore/powershell/docs/NullableShape.md new file mode 100644 index 000000000000..127110ad1c0d --- /dev/null +++ b/samples/client/petstore/powershell/docs/NullableShape.md @@ -0,0 +1,25 @@ +# NullableShape +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **String** | | +**TriangleType** | **String** | | +**QuadrilateralType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$NullableShape = Initialize-PSPetstoreNullableShape -ShapeType null ` + -TriangleType null ` + -QuadrilateralType null +``` + +- Convert the resource to JSON +```powershell +$NullableShape | ConvertTo-JSON +``` + +[[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/powershell/docs/NumberOnly.md b/samples/client/petstore/powershell/docs/NumberOnly.md new file mode 100644 index 000000000000..672595343afa --- /dev/null +++ b/samples/client/petstore/powershell/docs/NumberOnly.md @@ -0,0 +1,21 @@ +# NumberOnly +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustNumber** | **Decimal** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$NumberOnly = Initialize-PSPetstoreNumberOnly -JustNumber null +``` + +- Convert the resource to JSON +```powershell +$NumberOnly | ConvertTo-JSON +``` + +[[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/powershell/docs/ObjectWithDeprecatedFields.md b/samples/client/petstore/powershell/docs/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..e3911c6ecf8e --- /dev/null +++ b/samples/client/petstore/powershell/docs/ObjectWithDeprecatedFields.md @@ -0,0 +1,27 @@ +# ObjectWithDeprecatedFields +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Uuid** | **String** | | [optional] +**Id** | **Decimal** | | [optional] +**DeprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] +**Bars** | **String[]** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$ObjectWithDeprecatedFields = Initialize-PSPetstoreObjectWithDeprecatedFields -Uuid null ` + -Id null ` + -DeprecatedRef null ` + -Bars null +``` + +- Convert the resource to JSON +```powershell +$ObjectWithDeprecatedFields | ConvertTo-JSON +``` + +[[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/powershell/docs/Order.md b/samples/client/petstore/powershell/docs/Order.md index d7903c621b2d..8da0af886043 100644 --- a/samples/client/petstore/powershell/docs/Order.md +++ b/samples/client/petstore/powershell/docs/Order.md @@ -17,7 +17,7 @@ Name | Type | Description | Notes $Order = Initialize-PSPetstoreOrder -Id null ` -PetId null ` -Quantity null ` - -ShipDate null ` + -ShipDate 2020-02-02T20:20:20.000222Z ` -Status null ` -Complete null ``` diff --git a/samples/client/petstore/powershell/docs/OuterComposite.md b/samples/client/petstore/powershell/docs/OuterComposite.md new file mode 100644 index 000000000000..f9afa36a5242 --- /dev/null +++ b/samples/client/petstore/powershell/docs/OuterComposite.md @@ -0,0 +1,25 @@ +# OuterComposite +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MyNumber** | **Decimal** | | [optional] +**MyString** | **String** | | [optional] +**MyBoolean** | **Boolean** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$OuterComposite = Initialize-PSPetstoreOuterComposite -MyNumber null ` + -MyString null ` + -MyBoolean null +``` + +- Convert the resource to JSON +```powershell +$OuterComposite | ConvertTo-JSON +``` + +[[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/powershell/docs/OuterEnum.md b/samples/client/petstore/powershell/docs/OuterEnum.md new file mode 100644 index 000000000000..14f817afe9e9 --- /dev/null +++ b/samples/client/petstore/powershell/docs/OuterEnum.md @@ -0,0 +1,20 @@ +# OuterEnum +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Examples + +- Prepare the resource +```powershell +$OuterEnum = Initialize-PSPetstoreOuterEnum +``` + +- Convert the resource to JSON +```powershell +$OuterEnum | ConvertTo-JSON +``` + +[[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/powershell/docs/OuterEnumDefaultValue.md b/samples/client/petstore/powershell/docs/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..9d4f8e7d0a5e --- /dev/null +++ b/samples/client/petstore/powershell/docs/OuterEnumDefaultValue.md @@ -0,0 +1,20 @@ +# OuterEnumDefaultValue +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Examples + +- Prepare the resource +```powershell +$OuterEnumDefaultValue = Initialize-PSPetstoreOuterEnumDefaultValue +``` + +- Convert the resource to JSON +```powershell +$OuterEnumDefaultValue | ConvertTo-JSON +``` + +[[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/powershell/docs/OuterEnumInteger.md b/samples/client/petstore/powershell/docs/OuterEnumInteger.md new file mode 100644 index 000000000000..85162ed4ddb5 --- /dev/null +++ b/samples/client/petstore/powershell/docs/OuterEnumInteger.md @@ -0,0 +1,20 @@ +# OuterEnumInteger +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Examples + +- Prepare the resource +```powershell +$OuterEnumInteger = Initialize-PSPetstoreOuterEnumInteger +``` + +- Convert the resource to JSON +```powershell +$OuterEnumInteger | ConvertTo-JSON +``` + +[[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/powershell/docs/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/powershell/docs/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..c3d595f870c2 --- /dev/null +++ b/samples/client/petstore/powershell/docs/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,20 @@ +# OuterEnumIntegerDefaultValue +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Examples + +- Prepare the resource +```powershell +$OuterEnumIntegerDefaultValue = Initialize-PSPetstoreOuterEnumIntegerDefaultValue +``` + +- Convert the resource to JSON +```powershell +$OuterEnumIntegerDefaultValue | ConvertTo-JSON +``` + +[[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/powershell/docs/PSAnotherFakeApi.md b/samples/client/petstore/powershell/docs/PSAnotherFakeApi.md new file mode 100644 index 000000000000..ebdbaf3af0f4 --- /dev/null +++ b/samples/client/petstore/powershell/docs/PSAnotherFakeApi.md @@ -0,0 +1,52 @@ +# PSPetstore.PSPetstore/Api.PSAnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Invoke-PS123TestSpecialTags**](PSAnotherFakeApi.md#Invoke-PS123TestSpecialTags) | **PATCH** /another-fake/dummy | To test special tags + + + +# **Invoke-PS123TestSpecialTags** +> Client Invoke-PS123TestSpecialTags
+>         [-Client]
+ +To test special tags + +To test special tags and operation ID starting with number + +### Example +```powershell +$Client = Initialize-Client -Client "MyClient" # Client | client model + +# To test special tags +try { + $Result = Invoke-PS123TestSpecialTags -Client $Client +} catch { + Write-Host ("Exception occurred when calling Invoke-PS123TestSpecialTags: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) (PSCustomObject) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/PSDefaultApi.md b/samples/client/petstore/powershell/docs/PSDefaultApi.md new file mode 100644 index 000000000000..9c10aff593b6 --- /dev/null +++ b/samples/client/petstore/powershell/docs/PSDefaultApi.md @@ -0,0 +1,44 @@ +# PSPetstore.PSPetstore/Api.PSDefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Invoke-PSFooGet**](PSDefaultApi.md#Invoke-PSFooGet) | **GET** /foo | + + + +# **Invoke-PSFooGet** +> InlineResponseDefault Invoke-PSFooGet
+ + + +### Example +```powershell + +try { + $Result = Invoke-PSFooGet +} catch { + Write-Host ("Exception occurred when calling Invoke-PSFooGet: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**InlineResponseDefault**](InlineResponseDefault.md) (PSCustomObject) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/PSFakeApi.md b/samples/client/petstore/powershell/docs/PSFakeApi.md new file mode 100644 index 000000000000..8f22dd6ca054 --- /dev/null +++ b/samples/client/petstore/powershell/docs/PSFakeApi.md @@ -0,0 +1,751 @@ +# PSPetstore.PSPetstore/Api.PSFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Invoke-PSFakeHealthGet**](PSFakeApi.md#Invoke-PSFakeHealthGet) | **GET** /fake/health | Health check endpoint +[**Invoke-PSFakeOuterBooleanSerialize**](PSFakeApi.md#Invoke-PSFakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**Invoke-PSFakeOuterCompositeSerialize**](PSFakeApi.md#Invoke-PSFakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**Invoke-PSFakeOuterNumberSerialize**](PSFakeApi.md#Invoke-PSFakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**Invoke-PSFakeOuterStringSerialize**](PSFakeApi.md#Invoke-PSFakeOuterStringSerialize) | **POST** /fake/outer/string | +[**Get-PSArrayOfEnums**](PSFakeApi.md#Get-PSArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums +[**Test-PSBodyWithFileSchema**](PSFakeApi.md#Test-PSBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | +[**Test-PSBodyWithQueryParams**](PSFakeApi.md#Test-PSBodyWithQueryParams) | **PUT** /fake/body-with-query-params | +[**Test-PSClientModel**](PSFakeApi.md#Test-PSClientModel) | **PATCH** /fake | To test ""client"" model +[**Test-PSEndpointParameters**](PSFakeApi.md#Test-PSEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**Test-PSEnumParameters**](PSFakeApi.md#Test-PSEnumParameters) | **GET** /fake | To test enum parameters +[**Test-PSGroupParameters**](PSFakeApi.md#Test-PSGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**Test-PSInlineAdditionalProperties**](PSFakeApi.md#Test-PSInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**Test-PSJsonFormData**](PSFakeApi.md#Test-PSJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +[**Test-PSQueryParameterCollectionFormat**](PSFakeApi.md#Test-PSQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | + + + +# **Invoke-PSFakeHealthGet** +> HealthCheckResult Invoke-PSFakeHealthGet
+ +Health check endpoint + +### Example +```powershell + +# Health check endpoint +try { + $Result = Invoke-PSFakeHealthGet +} catch { + Write-Host ("Exception occurred when calling Invoke-PSFakeHealthGet: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) (PSCustomObject) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Invoke-PSFakeOuterBooleanSerialize** +> Boolean Invoke-PSFakeOuterBooleanSerialize
+>         [-Body]
+ + + +Test serialization of outer boolean types + +### Example +```powershell +$Body = $true # Boolean | Input boolean as post body (optional) + +try { + $Result = Invoke-PSFakeOuterBooleanSerialize -Body $Body +} catch { + Write-Host ("Exception occurred when calling Invoke-PSFakeOuterBooleanSerialize: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Body** | **Boolean**| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Invoke-PSFakeOuterCompositeSerialize** +> OuterComposite Invoke-PSFakeOuterCompositeSerialize
+>         [-OuterComposite]
+ + + +Test serialization of object with outer number type + +### Example +```powershell +$OuterComposite = Initialize-OuterComposite -MyNumber 0 -MyString "MyMyString" -MyBoolean $false # OuterComposite | Input composite as post body (optional) + +try { + $Result = Invoke-PSFakeOuterCompositeSerialize -OuterComposite $OuterComposite +} catch { + Write-Host ("Exception occurred when calling Invoke-PSFakeOuterCompositeSerialize: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **OuterComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) (PSCustomObject) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Invoke-PSFakeOuterNumberSerialize** +> Decimal Invoke-PSFakeOuterNumberSerialize
+>         [-Body]
+ + + +Test serialization of outer number types + +### Example +```powershell +$Body = 8.14 # Decimal | Input number as post body (optional) + +try { + $Result = Invoke-PSFakeOuterNumberSerialize -Body $Body +} catch { + Write-Host ("Exception occurred when calling Invoke-PSFakeOuterNumberSerialize: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Body** | **Decimal**| Input number as post body | [optional] + +### Return type + +**Decimal** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Invoke-PSFakeOuterStringSerialize** +> String Invoke-PSFakeOuterStringSerialize
+>         [-Body]
+ + + +Test serialization of outer string types + +### Example +```powershell +$Body = "MyBody" # String | Input string as post body (optional) + +try { + $Result = Invoke-PSFakeOuterStringSerialize -Body $Body +} catch { + Write-Host ("Exception occurred when calling Invoke-PSFakeOuterStringSerialize: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Body** | **String**| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Get-PSArrayOfEnums** +> OuterEnum[] Get-PSArrayOfEnums
+ +Array of Enums + +### Example +```powershell + +# Array of Enums +try { + $Result = Get-PSArrayOfEnums +} catch { + Write-Host ("Exception occurred when calling Get-PSArrayOfEnums: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**OuterEnum[]**](OuterEnum.md) (PSCustomObject) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-PSBodyWithFileSchema** +> void Test-PSBodyWithFileSchema
+>         [-FileSchemaTestClass]
+ + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```powershell +$File = Initialize-File -SourceURI "MySourceURI" +$FileSchemaTestClass = Initialize-FileSchemaTestClass -File $File -Files $File # FileSchemaTestClass | + +try { + $Result = Test-PSBodyWithFileSchema -FileSchemaTestClass $FileSchemaTestClass +} catch { + Write-Host ("Exception occurred when calling Test-PSBodyWithFileSchema: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **FileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-PSBodyWithQueryParams** +> void Test-PSBodyWithQueryParams
+>         [-Query]
+>         [-User]
+ + + +### Example +```powershell +$Query = "MyQuery" # String | +$User = Initialize-User -Id 0 -Username "MyUsername" -FirstName "MyFirstName" -LastName "MyLastName" -Email "MyEmail" -Password "MyPassword" -Phone "MyPhone" -UserStatus 0 -ObjectWithNoDeclaredProps -ObjectWithNoDeclaredPropsNullable -AnyTypeProp -AnyTypePropNullable # User | + +try { + $Result = Test-PSBodyWithQueryParams -Query $Query -User $User +} catch { + Write-Host ("Exception occurred when calling Test-PSBodyWithQueryParams: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Query** | **String**| | + **User** | [**User**](User.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-PSClientModel** +> Client Test-PSClientModel
+>         [-Client]
+ +To test ""client"" model + +To test ""client"" model + +### Example +```powershell +$Client = Initialize-Client -Client "MyClient" # Client | client model + +# To test ""client"" model +try { + $Result = Test-PSClientModel -Client $Client +} catch { + Write-Host ("Exception occurred when calling Test-PSClientModel: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) (PSCustomObject) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-PSEndpointParameters** +> void Test-PSEndpointParameters
+>         [-Number]
+>         [-Double]
+>         [-PatternWithoutDelimiter]
+>         [-Byte]
+>         [-Integer]
+>         [-Int32]
+>         [-Int64]
+>         [-Float]
+>         [-String]
+>         [-Binary]
+>         [-Date]
+>         [-DateTime]
+>         [-Password]
+>         [-Callback]
+ +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```powershell +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration +# Configure HTTP basic authorization: http_basic_test +$Configuration.Username = "YOUR_USERNAME" +$Configuration.Password = "YOUR_PASSWORD" + +$Number = 8.14 # Decimal | None +$Double = 1.2 # Double | None +$PatternWithoutDelimiter = "MyPatternWithoutDelimiter" # String | None +$Byte = # SystemByte | None +$Integer = 56 # Int32 | None (optional) +$Int32 = 56 # Int32 | None (optional) +$Int64 = 789 # Int64 | None (optional) +$Float = 3.4 # Double | None (optional) +$String = "MyString" # String | None (optional) +$Binary = # System.IO.FileInfo | None (optional) +$Date = (Get-Date) # System.DateTime | None (optional) +$DateTime = (Get-Date) # System.DateTime | None (optional) +$Password = "MyPassword" # String | None (optional) +$Callback = "MyCallback" # String | None (optional) + +# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +try { + $Result = Test-PSEndpointParameters -Number $Number -Double $Double -PatternWithoutDelimiter $PatternWithoutDelimiter -Byte $Byte -Integer $Integer -Int32 $Int32 -Int64 $Int64 -Float $Float -String $String -Binary $Binary -Date $Date -DateTime $DateTime -Password $Password -Callback $Callback +} catch { + Write-Host ("Exception occurred when calling Test-PSEndpointParameters: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Number** | **Decimal**| None | + **Double** | **Double**| None | + **PatternWithoutDelimiter** | **String**| None | + **Byte** | **SystemByte**| None | + **Integer** | **Int32**| None | [optional] + **Int32** | **Int32**| None | [optional] + **Int64** | **Int64**| None | [optional] + **Float** | **Double**| None | [optional] + **String** | **String**| None | [optional] + **Binary** | **System.IO.FileInfo****System.IO.FileInfo**| None | [optional] + **Date** | **System.DateTime**| None | [optional] + **DateTime** | **System.DateTime**| None | [optional] + **Password** | **String**| None | [optional] + **Callback** | **String**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-PSEnumParameters** +> void Test-PSEnumParameters
+>         [-EnumHeaderStringArray]
+>         [-EnumHeaderString]
+>         [-EnumQueryStringArray]
+>         [-EnumQueryString]
+>         [-EnumQueryInteger]
+>         [-EnumQueryDouble]
+>         [-EnumFormStringArray]
+>         [-EnumFormString]
+ +To test enum parameters + +To test enum parameters + +### Example +```powershell +$EnumHeaderStringArray = ">" # String[] | Header parameter enum test (string array) (optional) +$EnumHeaderString = "_abc" # String | Header parameter enum test (string) (optional) (default to "-efg") +$EnumQueryStringArray = ">" # String[] | Query parameter enum test (string array) (optional) +$EnumQueryString = "_abc" # String | Query parameter enum test (string) (optional) (default to "-efg") +$EnumQueryInteger = "1" # Int32 | Query parameter enum test (double) (optional) +$EnumQueryDouble = "1.1" # Double | Query parameter enum test (double) (optional) +$EnumFormStringArray = ">" # String[] | Form parameter enum test (string array) (optional) (default to "$") +$EnumFormString = "_abc" # String | Form parameter enum test (string) (optional) (default to "-efg") + +# To test enum parameters +try { + $Result = Test-PSEnumParameters -EnumHeaderStringArray $EnumHeaderStringArray -EnumHeaderString $EnumHeaderString -EnumQueryStringArray $EnumQueryStringArray -EnumQueryString $EnumQueryString -EnumQueryInteger $EnumQueryInteger -EnumQueryDouble $EnumQueryDouble -EnumFormStringArray $EnumFormStringArray -EnumFormString $EnumFormString +} catch { + Write-Host ("Exception occurred when calling Test-PSEnumParameters: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **EnumHeaderStringArray** | [**String[]**](String.md)| Header parameter enum test (string array) | [optional] + **EnumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to "-efg"] + **EnumQueryStringArray** | [**String[]**](String.md)| Query parameter enum test (string array) | [optional] + **EnumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to "-efg"] + **EnumQueryInteger** | **Int32**| Query parameter enum test (double) | [optional] + **EnumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] + **EnumFormStringArray** | [**String[]**](String.md)| Form parameter enum test (string array) | [optional] [default to "$"] + **EnumFormString** | **String**| Form parameter enum test (string) | [optional] [default to "-efg"] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-PSGroupParameters** +> void Test-PSGroupParameters
+>         [-RequiredStringGroup]
+>         [-RequiredBooleanGroup]
+>         [-RequiredInt64Group]
+>         [-StringGroup]
+>         [-BooleanGroup]
+>         [-Int64Group]
+ +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```powershell +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration +# Configure HTTP basic authorization: bearer_test +$Configuration.Username = "YOUR_USERNAME" +$Configuration.Password = "YOUR_PASSWORD" + +$RequiredStringGroup = 56 # Int32 | Required String in group parameters +$RequiredBooleanGroup = $true # Boolean | Required Boolean in group parameters +$RequiredInt64Group = 789 # Int64 | Required Integer in group parameters +$StringGroup = 56 # Int32 | String in group parameters (optional) +$BooleanGroup = $true # Boolean | Boolean in group parameters (optional) +$Int64Group = 789 # Int64 | Integer in group parameters (optional) + +# Fake endpoint to test group parameters (optional) +try { + $Result = Test-PSGroupParameters -RequiredStringGroup $RequiredStringGroup -RequiredBooleanGroup $RequiredBooleanGroup -RequiredInt64Group $RequiredInt64Group -StringGroup $StringGroup -BooleanGroup $BooleanGroup -Int64Group $Int64Group +} catch { + Write-Host ("Exception occurred when calling Test-PSGroupParameters: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **RequiredStringGroup** | **Int32**| Required String in group parameters | + **RequiredBooleanGroup** | **Boolean**| Required Boolean in group parameters | + **RequiredInt64Group** | **Int64**| Required Integer in group parameters | + **StringGroup** | **Int32**| String in group parameters | [optional] + **BooleanGroup** | **Boolean**| Boolean in group parameters | [optional] + **Int64Group** | **Int64**| Integer in group parameters | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-PSInlineAdditionalProperties** +> void Test-PSInlineAdditionalProperties
+>         [-RequestBody]
+ +test inline additionalProperties + + + +### Example +```powershell +$RequestBody = @{ key_example = "MyInner" } # System.Collections.Hashtable | request body + +# test inline additionalProperties +try { + $Result = Test-PSInlineAdditionalProperties -RequestBody $RequestBody +} catch { + Write-Host ("Exception occurred when calling Test-PSInlineAdditionalProperties: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **RequestBody** | [**System.Collections.Hashtable**](String.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-PSJsonFormData** +> void Test-PSJsonFormData
+>         [-Param]
+>         [-Param2]
+ +test json serialization of form data + + + +### Example +```powershell +$Param = "MyParam" # String | field1 +$Param2 = "MyParam2" # String | field2 + +# test json serialization of form data +try { + $Result = Test-PSJsonFormData -Param $Param -Param2 $Param2 +} catch { + Write-Host ("Exception occurred when calling Test-PSJsonFormData: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Param** | **String**| field1 | + **Param2** | **String**| field2 | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-PSQueryParameterCollectionFormat** +> void Test-PSQueryParameterCollectionFormat
+>         [-Pipe]
+>         [-Ioutil]
+>         [-Http]
+>         [-Url]
+>         [-Context]
+ + + +To test the collection format in query parameters + +### Example +```powershell +$Pipe = "MyPipe" # String[] | +$Ioutil = "MyIoutil" # String[] | +$Http = "MyHttp" # String[] | +$Url = "MyUrl" # String[] | +$Context = "MyContext" # String[] | + +try { + $Result = Test-PSQueryParameterCollectionFormat -Pipe $Pipe -Ioutil $Ioutil -Http $Http -Url $Url -Context $Context +} catch { + Write-Host ("Exception occurred when calling Test-PSQueryParameterCollectionFormat: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Pipe** | [**String[]**](String.md)| | + **Ioutil** | [**String[]**](String.md)| | + **Http** | [**String[]**](String.md)| | + **Url** | [**String[]**](String.md)| | + **Context** | [**String[]**](String.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/PSFakeClassnameTags123Api.md b/samples/client/petstore/powershell/docs/PSFakeClassnameTags123Api.md new file mode 100644 index 000000000000..5b775f25298f --- /dev/null +++ b/samples/client/petstore/powershell/docs/PSFakeClassnameTags123Api.md @@ -0,0 +1,59 @@ +# PSPetstore.PSPetstore/Api.PSFakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Test-PSClassname**](PSFakeClassnameTags123Api.md#Test-PSClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + + +# **Test-PSClassname** +> Client Test-PSClassname
+>         [-Client]
+ +To test class name in snake case + +To test class name in snake case + +### Example +```powershell +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration +# Configure API key authorization: api_key_query +$Configuration.ApiKey.api_key_query = "YOUR_API_KEY" +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#$Configuration.ApiKeyPrefix.api_key_query = "Bearer" + +$Client = Initialize-Client -Client "MyClient" # Client | client model + +# To test class name in snake case +try { + $Result = Test-PSClassname -Client $Client +} catch { + Write-Host ("Exception occurred when calling Test-PSClassname: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) (PSCustomObject) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/PSPetApi.md b/samples/client/petstore/powershell/docs/PSPetApi.md index c24d5de326c5..aa5a2db7167d 100644 --- a/samples/client/petstore/powershell/docs/PSPetApi.md +++ b/samples/client/petstore/powershell/docs/PSPetApi.md @@ -12,11 +12,12 @@ Method | HTTP request | Description [**Update-PSPet**](PSPetApi.md#Update-PSPet) | **PUT** /pet | Update an existing pet [**Update-PSPetWithForm**](PSPetApi.md#Update-PSPetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data [**Invoke-PSUploadFile**](PSPetApi.md#Invoke-PSUploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**Invoke-PSUploadFileWithRequiredFile**](PSPetApi.md#Invoke-PSUploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) # **Add-PSPet** -> Pet Add-PSPet
+> void Add-PSPet
>         [-Pet]
Add a new pet to the store @@ -27,6 +28,18 @@ Add a new pet to the store ```powershell # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration +# Configure HTTP basic authorization: http_signature_test +$Configuration.Username = "YOUR_USERNAME" +$Configuration.Password = "YOUR_PASSWORD" +# Configure HttpSignature for authorization :http_signature_test +$httpSigningParams = @{ + KeyId = "xxxxxx1776876789ac747/xxxxxxx564612d31a62c01/xxxxxxxa1d7564612d31a66ee8" + KeyFilePath = "C:\SecretKey.txt" + HttpSigningHeader = @("(request-target)","Host","Date","Digest") + HashAlgorithm = "sha256" +} +Set-ConfigurationHttpSigning $httpSigningParams + # Configure OAuth2 access token for authorization: petstore_auth $Configuration.AccessToken = "YOUR_ACCESS_TOKEN" @@ -51,16 +64,16 @@ Name | Type | Description | Notes ### Return type -[**Pet**](Pet.md) (PSCustomObject) +void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth) +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -128,6 +141,18 @@ Multiple status values can be provided with comma separated strings ```powershell # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration +# Configure HTTP basic authorization: http_signature_test +$Configuration.Username = "YOUR_USERNAME" +$Configuration.Password = "YOUR_PASSWORD" +# Configure HttpSignature for authorization :http_signature_test +$httpSigningParams = @{ + KeyId = "xxxxxx1776876789ac747/xxxxxxx564612d31a62c01/xxxxxxxa1d7564612d31a66ee8" + KeyFilePath = "C:\SecretKey.txt" + HttpSigningHeader = @("(request-target)","Host","Date","Digest") + HashAlgorithm = "sha256" +} +Set-ConfigurationHttpSigning $httpSigningParams + # Configure OAuth2 access token for authorization: petstore_auth $Configuration.AccessToken = "YOUR_ACCESS_TOKEN" @@ -154,7 +179,7 @@ Name | Type | Description | Notes ### Authorization -[petstore_auth](../README.md#petstore_auth) +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) ### HTTP request headers @@ -176,6 +201,18 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```powershell # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration +# Configure HTTP basic authorization: http_signature_test +$Configuration.Username = "YOUR_USERNAME" +$Configuration.Password = "YOUR_PASSWORD" +# Configure HttpSignature for authorization :http_signature_test +$httpSigningParams = @{ + KeyId = "xxxxxx1776876789ac747/xxxxxxx564612d31a62c01/xxxxxxxa1d7564612d31a66ee8" + KeyFilePath = "C:\SecretKey.txt" + HttpSigningHeader = @("(request-target)","Host","Date","Digest") + HashAlgorithm = "sha256" +} +Set-ConfigurationHttpSigning $httpSigningParams + # Configure OAuth2 access token for authorization: petstore_auth $Configuration.AccessToken = "YOUR_ACCESS_TOKEN" @@ -202,7 +239,7 @@ Name | Type | Description | Notes ### Authorization -[petstore_auth](../README.md#petstore_auth) +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) ### HTTP request headers @@ -263,7 +300,7 @@ Name | Type | Description | Notes # **Update-PSPet** -> Pet Update-PSPet
+> void Update-PSPet
>         [-Pet]
Update an existing pet @@ -274,6 +311,18 @@ Update an existing pet ```powershell # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration +# Configure HTTP basic authorization: http_signature_test +$Configuration.Username = "YOUR_USERNAME" +$Configuration.Password = "YOUR_PASSWORD" +# Configure HttpSignature for authorization :http_signature_test +$httpSigningParams = @{ + KeyId = "xxxxxx1776876789ac747/xxxxxxx564612d31a62c01/xxxxxxxa1d7564612d31a66ee8" + KeyFilePath = "C:\SecretKey.txt" + HttpSigningHeader = @("(request-target)","Host","Date","Digest") + HashAlgorithm = "sha256" +} +Set-ConfigurationHttpSigning $httpSigningParams + # Configure OAuth2 access token for authorization: petstore_auth $Configuration.AccessToken = "YOUR_ACCESS_TOKEN" @@ -298,16 +347,16 @@ Name | Type | Description | Notes ### Return type -[**Pet**](Pet.md) (PSCustomObject) +void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth) +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -419,3 +468,57 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **Invoke-PSUploadFileWithRequiredFile** +> ApiResponse Invoke-PSUploadFileWithRequiredFile
+>         [-PetId]
+>         [-RequiredFile]
+>         [-AdditionalMetadata]
+ +uploads an image (required) + + + +### Example +```powershell +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration +# Configure OAuth2 access token for authorization: petstore_auth +$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" + +$PetId = 789 # Int64 | ID of pet to update +$RequiredFile = # System.IO.FileInfo | file to upload +$AdditionalMetadata = "MyAdditionalMetadata" # String | Additional data to pass to server (optional) + +# uploads an image (required) +try { + $Result = Invoke-PSUploadFileWithRequiredFile -PetId $PetId -RequiredFile $RequiredFile -AdditionalMetadata $AdditionalMetadata +} catch { + Write-Host ("Exception occurred when calling Invoke-PSUploadFileWithRequiredFile: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **PetId** | **Int64**| ID of pet to update | + **RequiredFile** | **System.IO.FileInfo****System.IO.FileInfo**| file to upload | + **AdditionalMetadata** | **String**| Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) (PSCustomObject) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/PSStoreApi.md b/samples/client/petstore/powershell/docs/PSStoreApi.md index 2bcc27fd7491..6f7dac409bdd 100644 --- a/samples/client/petstore/powershell/docs/PSStoreApi.md +++ b/samples/client/petstore/powershell/docs/PSStoreApi.md @@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**Remove-PSOrder**](PSStoreApi.md#Remove-PSOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**Remove-PSOrder**](PSStoreApi.md#Remove-PSOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID [**Get-PSInventory**](PSStoreApi.md#Get-PSInventory) | **GET** /store/inventory | Returns pet inventories by status -[**Get-PSOrderById**](PSStoreApi.md#Get-PSOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +[**Get-PSOrderById**](PSStoreApi.md#Get-PSOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID [**Invoke-PSPlaceOrder**](PSStoreApi.md#Invoke-PSPlaceOrder) | **POST** /store/order | Place an order for a pet diff --git a/samples/client/petstore/powershell/docs/PSUserApi.md b/samples/client/petstore/powershell/docs/PSUserApi.md index ba7c2b092869..567ad5098511 100644 --- a/samples/client/petstore/powershell/docs/PSUserApi.md +++ b/samples/client/petstore/powershell/docs/PSUserApi.md @@ -25,14 +25,7 @@ This can only be done by the logged in user. ### Example ```powershell -# general setting of the PowerShell module, e.g. base URL, authentication, etc -$Configuration = Get-Configuration -# Configure API key authorization: auth_cookie -$Configuration.ApiKey.AUTH_KEY = "YOUR_API_KEY" -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration.ApiKeyPrefix.AUTH_KEY = "Bearer" - -$User = Initialize-User -Id 0 -Username "MyUsername" -FirstName "MyFirstName" -LastName "MyLastName" -Email "MyEmail" -Password "MyPassword" -Phone "MyPhone" -UserStatus 0 # User | Created user object +$User = Initialize-User -Id 0 -Username "MyUsername" -FirstName "MyFirstName" -LastName "MyLastName" -Email "MyEmail" -Password "MyPassword" -Phone "MyPhone" -UserStatus 0 -ObjectWithNoDeclaredProps -ObjectWithNoDeclaredPropsNullable -AnyTypeProp -AnyTypePropNullable # User | Created user object # Create user try { @@ -55,7 +48,7 @@ void (empty response body) ### Authorization -[auth_cookie](../README.md#auth_cookie) +No authorization required ### HTTP request headers @@ -75,14 +68,7 @@ Creates list of users with given input array ### Example ```powershell -# general setting of the PowerShell module, e.g. base URL, authentication, etc -$Configuration = Get-Configuration -# Configure API key authorization: auth_cookie -$Configuration.ApiKey.AUTH_KEY = "YOUR_API_KEY" -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration.ApiKeyPrefix.AUTH_KEY = "Bearer" - -$User = Initialize-User -Id 0 -Username "MyUsername" -FirstName "MyFirstName" -LastName "MyLastName" -Email "MyEmail" -Password "MyPassword" -Phone "MyPhone" -UserStatus 0 # User[] | List of user object +$User = Initialize-User -Id 0 -Username "MyUsername" -FirstName "MyFirstName" -LastName "MyLastName" -Email "MyEmail" -Password "MyPassword" -Phone "MyPhone" -UserStatus 0 -ObjectWithNoDeclaredProps -ObjectWithNoDeclaredPropsNullable -AnyTypeProp -AnyTypePropNullable # User[] | List of user object # Creates list of users with given input array try { @@ -105,7 +91,7 @@ void (empty response body) ### Authorization -[auth_cookie](../README.md#auth_cookie) +No authorization required ### HTTP request headers @@ -125,14 +111,7 @@ Creates list of users with given input array ### Example ```powershell -# general setting of the PowerShell module, e.g. base URL, authentication, etc -$Configuration = Get-Configuration -# Configure API key authorization: auth_cookie -$Configuration.ApiKey.AUTH_KEY = "YOUR_API_KEY" -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration.ApiKeyPrefix.AUTH_KEY = "Bearer" - -$User = Initialize-User -Id 0 -Username "MyUsername" -FirstName "MyFirstName" -LastName "MyLastName" -Email "MyEmail" -Password "MyPassword" -Phone "MyPhone" -UserStatus 0 # User[] | List of user object +$User = Initialize-User -Id 0 -Username "MyUsername" -FirstName "MyFirstName" -LastName "MyLastName" -Email "MyEmail" -Password "MyPassword" -Phone "MyPhone" -UserStatus 0 -ObjectWithNoDeclaredProps -ObjectWithNoDeclaredPropsNullable -AnyTypeProp -AnyTypePropNullable # User[] | List of user object # Creates list of users with given input array try { @@ -155,7 +134,7 @@ void (empty response body) ### Authorization -[auth_cookie](../README.md#auth_cookie) +No authorization required ### HTTP request headers @@ -175,13 +154,6 @@ This can only be done by the logged in user. ### Example ```powershell -# general setting of the PowerShell module, e.g. base URL, authentication, etc -$Configuration = Get-Configuration -# Configure API key authorization: auth_cookie -$Configuration.ApiKey.AUTH_KEY = "YOUR_API_KEY" -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration.ApiKeyPrefix.AUTH_KEY = "Bearer" - $Username = "MyUsername" # String | The name that needs to be deleted # Delete user @@ -205,7 +177,7 @@ void (empty response body) ### Authorization -[auth_cookie](../README.md#auth_cookie) +No authorization required ### HTTP request headers @@ -313,13 +285,6 @@ Logs out current logged in user session ### Example ```powershell -# general setting of the PowerShell module, e.g. base URL, authentication, etc -$Configuration = Get-Configuration -# Configure API key authorization: auth_cookie -$Configuration.ApiKey.AUTH_KEY = "YOUR_API_KEY" -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration.ApiKeyPrefix.AUTH_KEY = "Bearer" - # Logs out current logged in user session try { @@ -339,7 +304,7 @@ void (empty response body) ### Authorization -[auth_cookie](../README.md#auth_cookie) +No authorization required ### HTTP request headers @@ -360,15 +325,8 @@ This can only be done by the logged in user. ### Example ```powershell -# general setting of the PowerShell module, e.g. base URL, authentication, etc -$Configuration = Get-Configuration -# Configure API key authorization: auth_cookie -$Configuration.ApiKey.AUTH_KEY = "YOUR_API_KEY" -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration.ApiKeyPrefix.AUTH_KEY = "Bearer" - $Username = "MyUsername" # String | name that need to be deleted -$User = Initialize-User -Id 0 -Username "MyUsername" -FirstName "MyFirstName" -LastName "MyLastName" -Email "MyEmail" -Password "MyPassword" -Phone "MyPhone" -UserStatus 0 # User | Updated user object +$User = Initialize-User -Id 0 -Username "MyUsername" -FirstName "MyFirstName" -LastName "MyLastName" -Email "MyEmail" -Password "MyPassword" -Phone "MyPhone" -UserStatus 0 -ObjectWithNoDeclaredProps -ObjectWithNoDeclaredPropsNullable -AnyTypeProp -AnyTypePropNullable # User | Updated user object # Updated user try { @@ -392,7 +350,7 @@ void (empty response body) ### Authorization -[auth_cookie](../README.md#auth_cookie) +No authorization required ### HTTP request headers diff --git a/samples/client/petstore/powershell/docs/ParentPet.md b/samples/client/petstore/powershell/docs/ParentPet.md new file mode 100644 index 000000000000..f058cc20b7fb --- /dev/null +++ b/samples/client/petstore/powershell/docs/ParentPet.md @@ -0,0 +1,21 @@ +# ParentPet +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PetType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$ParentPet = Initialize-PSPetstoreParentPet -PetType null +``` + +- Convert the resource to JSON +```powershell +$ParentPet | ConvertTo-JSON +``` + +[[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/powershell/docs/PetWithRequiredTags.md b/samples/client/petstore/powershell/docs/PetWithRequiredTags.md new file mode 100644 index 000000000000..b85716daa4c5 --- /dev/null +++ b/samples/client/petstore/powershell/docs/PetWithRequiredTags.md @@ -0,0 +1,31 @@ +# PetWithRequiredTags +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **Int64** | | [optional] +**Category** | [**Category**](Category.md) | | [optional] +**Name** | **String** | | +**PhotoUrls** | **String[]** | | +**Tags** | [**Tag[]**](Tag.md) | | +**Status** | **String** | pet status in the store | [optional] + +## Examples + +- Prepare the resource +```powershell +$PetWithRequiredTags = Initialize-PSPetstorePetWithRequiredTags -Id null ` + -Category null ` + -Name doggie ` + -PhotoUrls null ` + -Tags null ` + -Status null +``` + +- Convert the resource to JSON +```powershell +$PetWithRequiredTags | ConvertTo-JSON +``` + +[[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/powershell/docs/Pig.md b/samples/client/petstore/powershell/docs/Pig.md new file mode 100644 index 000000000000..705259e7501a --- /dev/null +++ b/samples/client/petstore/powershell/docs/Pig.md @@ -0,0 +1,21 @@ +# Pig +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$Pig = Initialize-PSPetstorePig -ClassName null +``` + +- Convert the resource to JSON +```powershell +$Pig | ConvertTo-JSON +``` + +[[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/powershell/docs/Quadrilateral.md b/samples/client/petstore/powershell/docs/Quadrilateral.md new file mode 100644 index 000000000000..7df7e807dc3d --- /dev/null +++ b/samples/client/petstore/powershell/docs/Quadrilateral.md @@ -0,0 +1,23 @@ +# Quadrilateral +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **String** | | +**QuadrilateralType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$Quadrilateral = Initialize-PSPetstoreQuadrilateral -ShapeType null ` + -QuadrilateralType null +``` + +- Convert the resource to JSON +```powershell +$Quadrilateral | ConvertTo-JSON +``` + +[[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/powershell/docs/QuadrilateralInterface.md b/samples/client/petstore/powershell/docs/QuadrilateralInterface.md new file mode 100644 index 000000000000..c5cd0a220854 --- /dev/null +++ b/samples/client/petstore/powershell/docs/QuadrilateralInterface.md @@ -0,0 +1,21 @@ +# QuadrilateralInterface +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$QuadrilateralInterface = Initialize-PSPetstoreQuadrilateralInterface -QuadrilateralType null +``` + +- Convert the resource to JSON +```powershell +$QuadrilateralInterface | ConvertTo-JSON +``` + +[[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/powershell/docs/ReadOnlyFirst.md b/samples/client/petstore/powershell/docs/ReadOnlyFirst.md new file mode 100644 index 000000000000..d31235396d3f --- /dev/null +++ b/samples/client/petstore/powershell/docs/ReadOnlyFirst.md @@ -0,0 +1,23 @@ +# ReadOnlyFirst +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **String** | | [optional] [readonly] +**Baz** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$ReadOnlyFirst = Initialize-PSPetstoreReadOnlyFirst -Bar null ` + -Baz null +``` + +- Convert the resource to JSON +```powershell +$ReadOnlyFirst | ConvertTo-JSON +``` + +[[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/powershell/docs/Return.md b/samples/client/petstore/powershell/docs/Return.md new file mode 100644 index 000000000000..461d10547c8b --- /dev/null +++ b/samples/client/petstore/powershell/docs/Return.md @@ -0,0 +1,21 @@ +# ModelReturn +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VarReturn** | **Int32** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$ModelReturn = Initialize-PSPetstoreModelReturn -VarReturn null +``` + +- Convert the resource to JSON +```powershell +$ModelReturn | ConvertTo-JSON +``` + +[[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/powershell/docs/ScaleneTriangle.md b/samples/client/petstore/powershell/docs/ScaleneTriangle.md new file mode 100644 index 000000000000..df0a826f4682 --- /dev/null +++ b/samples/client/petstore/powershell/docs/ScaleneTriangle.md @@ -0,0 +1,23 @@ +# ScaleneTriangle +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **String** | | +**TriangleType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$ScaleneTriangle = Initialize-PSPetstoreScaleneTriangle -ShapeType null ` + -TriangleType null +``` + +- Convert the resource to JSON +```powershell +$ScaleneTriangle | ConvertTo-JSON +``` + +[[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/powershell/docs/Shape.md b/samples/client/petstore/powershell/docs/Shape.md new file mode 100644 index 000000000000..42b008286a5d --- /dev/null +++ b/samples/client/petstore/powershell/docs/Shape.md @@ -0,0 +1,25 @@ +# Shape +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **String** | | +**TriangleType** | **String** | | +**QuadrilateralType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$Shape = Initialize-PSPetstoreShape -ShapeType null ` + -TriangleType null ` + -QuadrilateralType null +``` + +- Convert the resource to JSON +```powershell +$Shape | ConvertTo-JSON +``` + +[[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/powershell/docs/ShapeInterface.md b/samples/client/petstore/powershell/docs/ShapeInterface.md new file mode 100644 index 000000000000..cba56744b3db --- /dev/null +++ b/samples/client/petstore/powershell/docs/ShapeInterface.md @@ -0,0 +1,21 @@ +# ShapeInterface +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$ShapeInterface = Initialize-PSPetstoreShapeInterface -ShapeType null +``` + +- Convert the resource to JSON +```powershell +$ShapeInterface | ConvertTo-JSON +``` + +[[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/powershell/docs/ShapeOrNull.md b/samples/client/petstore/powershell/docs/ShapeOrNull.md new file mode 100644 index 000000000000..e237db3c1155 --- /dev/null +++ b/samples/client/petstore/powershell/docs/ShapeOrNull.md @@ -0,0 +1,25 @@ +# ShapeOrNull +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **String** | | +**TriangleType** | **String** | | +**QuadrilateralType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$ShapeOrNull = Initialize-PSPetstoreShapeOrNull -ShapeType null ` + -TriangleType null ` + -QuadrilateralType null +``` + +- Convert the resource to JSON +```powershell +$ShapeOrNull | ConvertTo-JSON +``` + +[[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/powershell/docs/SimpleQuadrilateral.md b/samples/client/petstore/powershell/docs/SimpleQuadrilateral.md new file mode 100644 index 000000000000..df5bdea7f0cd --- /dev/null +++ b/samples/client/petstore/powershell/docs/SimpleQuadrilateral.md @@ -0,0 +1,23 @@ +# SimpleQuadrilateral +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **String** | | +**QuadrilateralType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$SimpleQuadrilateral = Initialize-PSPetstoreSimpleQuadrilateral -ShapeType null ` + -QuadrilateralType null +``` + +- Convert the resource to JSON +```powershell +$SimpleQuadrilateral | ConvertTo-JSON +``` + +[[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/powershell/docs/SpecialModelName.md b/samples/client/petstore/powershell/docs/SpecialModelName.md new file mode 100644 index 000000000000..02562eeabbbc --- /dev/null +++ b/samples/client/petstore/powershell/docs/SpecialModelName.md @@ -0,0 +1,23 @@ +# SpecialModelName +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SpecialPropertyName** | **Int64** | | [optional] +**SpecialModelName** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$SpecialModelName = Initialize-PSPetstoreSpecialModelName -SpecialPropertyName null ` + -SpecialModelName null +``` + +- Convert the resource to JSON +```powershell +$SpecialModelName | ConvertTo-JSON +``` + +[[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/powershell/docs/Triangle.md b/samples/client/petstore/powershell/docs/Triangle.md new file mode 100644 index 000000000000..cfdebe89c17f --- /dev/null +++ b/samples/client/petstore/powershell/docs/Triangle.md @@ -0,0 +1,23 @@ +# Triangle +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **String** | | +**TriangleType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$Triangle = Initialize-PSPetstoreTriangle -ShapeType null ` + -TriangleType null +``` + +- Convert the resource to JSON +```powershell +$Triangle | ConvertTo-JSON +``` + +[[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/powershell/docs/TriangleInterface.md b/samples/client/petstore/powershell/docs/TriangleInterface.md new file mode 100644 index 000000000000..d984318cf6db --- /dev/null +++ b/samples/client/petstore/powershell/docs/TriangleInterface.md @@ -0,0 +1,21 @@ +# TriangleInterface +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TriangleType** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$TriangleInterface = Initialize-PSPetstoreTriangleInterface -TriangleType null +``` + +- Convert the resource to JSON +```powershell +$TriangleInterface | ConvertTo-JSON +``` + +[[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/powershell/docs/User.md b/samples/client/petstore/powershell/docs/User.md index 42b31bc9f007..8c6319df5d21 100644 --- a/samples/client/petstore/powershell/docs/User.md +++ b/samples/client/petstore/powershell/docs/User.md @@ -11,6 +11,10 @@ Name | Type | Description | Notes **Password** | **String** | | [optional] **Phone** | **String** | | [optional] **UserStatus** | **Int32** | User Status | [optional] +**ObjectWithNoDeclaredProps** | [**SystemCollectionsHashtable**](.md) | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] +**ObjectWithNoDeclaredPropsNullable** | [**SystemCollectionsHashtable**](.md) | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] +**AnyTypeProp** | [**AnyType**](.md) | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 | [optional] +**AnyTypePropNullable** | [**AnyType**](.md) | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. | [optional] ## Examples @@ -23,7 +27,11 @@ $User = Initialize-PSPetstoreUser -Id null ` -Email null ` -Password null ` -Phone null ` - -UserStatus null + -UserStatus null ` + -ObjectWithNoDeclaredProps null ` + -ObjectWithNoDeclaredPropsNullable null ` + -AnyTypeProp null ` + -AnyTypePropNullable null ``` - Convert the resource to JSON diff --git a/samples/client/petstore/powershell/docs/Whale.md b/samples/client/petstore/powershell/docs/Whale.md new file mode 100644 index 000000000000..e671dcc10c17 --- /dev/null +++ b/samples/client/petstore/powershell/docs/Whale.md @@ -0,0 +1,25 @@ +# Whale +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**HasBaleen** | **Boolean** | | [optional] +**HasTeeth** | **Boolean** | | [optional] +**ClassName** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$Whale = Initialize-PSPetstoreWhale -HasBaleen null ` + -HasTeeth null ` + -ClassName null +``` + +- Convert the resource to JSON +```powershell +$Whale | ConvertTo-JSON +``` + +[[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/powershell/docs/Zebra.md b/samples/client/petstore/powershell/docs/Zebra.md new file mode 100644 index 000000000000..3c52ed299f4c --- /dev/null +++ b/samples/client/petstore/powershell/docs/Zebra.md @@ -0,0 +1,23 @@ +# Zebra +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type** | **String** | | [optional] +**ClassName** | **String** | | + +## Examples + +- Prepare the resource +```powershell +$Zebra = Initialize-PSPetstoreZebra -Type null ` + -ClassName null +``` + +- Convert the resource to JSON +```powershell +$Zebra | ConvertTo-JSON +``` + +[[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/powershell/src/PSPetstore/Api/PSAnotherFakeApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSAnotherFakeApi.ps1 new file mode 100644 index 000000000000..bea25f35712c --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSAnotherFakeApi.ps1 @@ -0,0 +1,85 @@ +# +# OpenAPI Petstore +# This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +To test special tags + +.DESCRIPTION + +No description available. + +.PARAMETER Client +client model + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +Client +#> +function Invoke-PS123TestSpecialTags { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${Client}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Invoke-PS123TestSpecialTags' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('application/json') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/another-fake/dummy' + + if (!$Client) { + throw "Error! The required parameter `Client` missing when calling 123TestSpecialTags." + } + + $LocalVarBodyParameter = $Client | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-PSApiClient -Method 'PATCH' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "Client" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSDefaultApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSDefaultApi.ps1 new file mode 100644 index 000000000000..9153f38bcc30 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSDefaultApi.ps1 @@ -0,0 +1,70 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +InlineResponseDefault +#> +function Invoke-PSFooGet { + [CmdletBinding()] + Param ( + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Invoke-PSFooGet' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('application/json') + + $LocalVarUri = '/foo' + + $LocalVarResult = Invoke-PSApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "InlineResponseDefault" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeApi.ps1 new file mode 100644 index 000000000000..7d2c4596574b --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeApi.ps1 @@ -0,0 +1,1436 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +Health check endpoint + +.DESCRIPTION + +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +HealthCheckResult +#> +function Invoke-PSFakeHealthGet { + [CmdletBinding()] + Param ( + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Invoke-PSFakeHealthGet' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('application/json') + + $LocalVarUri = '/fake/health' + + $LocalVarResult = Invoke-PSApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "HealthCheckResult" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Body +Input boolean as post body + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +Boolean +#> +function Invoke-PSFakeOuterBooleanSerialize { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Boolean]] + ${Body}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Invoke-PSFakeOuterBooleanSerialize' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('*/*') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/fake/outer/boolean' + + $LocalVarBodyParameter = $Body | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-PSApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "Boolean" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER OuterComposite +Input composite as post body + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +OuterComposite +#> +function Invoke-PSFakeOuterCompositeSerialize { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${OuterComposite}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Invoke-PSFakeOuterCompositeSerialize' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('*/*') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/fake/outer/composite' + + $LocalVarBodyParameter = $OuterComposite | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-PSApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "OuterComposite" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Body +Input number as post body + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +Decimal +#> +function Invoke-PSFakeOuterNumberSerialize { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Decimal]] + ${Body}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Invoke-PSFakeOuterNumberSerialize' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('*/*') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/fake/outer/number' + + $LocalVarBodyParameter = $Body | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-PSApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "Decimal" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Body +Input string as post body + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Invoke-PSFakeOuterStringSerialize { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${Body}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Invoke-PSFakeOuterStringSerialize' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('*/*') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/fake/outer/string' + + $LocalVarBodyParameter = $Body | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-PSApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Array of Enums + +.DESCRIPTION + +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +OuterEnum[] +#> +function Get-PSArrayOfEnums { + [CmdletBinding()] + Param ( + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Get-PSArrayOfEnums' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('application/json') + + $LocalVarUri = '/fake/array-of-enums' + + $LocalVarResult = Invoke-PSApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "OuterEnum[]" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER FileSchemaTestClass +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +None +#> +function Test-PSBodyWithFileSchema { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${FileSchemaTestClass}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-PSBodyWithFileSchema' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/fake/body-with-file-schema' + + if (!$FileSchemaTestClass) { + throw "Error! The required parameter `FileSchemaTestClass` missing when calling testBodyWithFileSchema." + } + + $LocalVarBodyParameter = $FileSchemaTestClass | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-PSApiClient -Method 'PUT' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Query +No description available. + +.PARAMETER User +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +None +#> +function Test-PSBodyWithQueryParams { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${Query}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${User}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-PSBodyWithQueryParams' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/fake/body-with-query-params' + + if (!$Query) { + throw "Error! The required parameter `Query` missing when calling testBodyWithQueryParams." + } + $LocalVarQueryParameters['query'] = $Query + + if (!$User) { + throw "Error! The required parameter `User` missing when calling testBodyWithQueryParams." + } + + $LocalVarBodyParameter = $User | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-PSApiClient -Method 'PUT' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +To test ""client"" model + +.DESCRIPTION + +No description available. + +.PARAMETER Client +client model + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +Client +#> +function Test-PSClientModel { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${Client}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-PSClientModel' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('application/json') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/fake' + + if (!$Client) { + throw "Error! The required parameter `Client` missing when calling testClientModel." + } + + $LocalVarBodyParameter = $Client | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-PSApiClient -Method 'PATCH' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "Client" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +.DESCRIPTION + +No description available. + +.PARAMETER Number +None + +.PARAMETER Double +None + +.PARAMETER PatternWithoutDelimiter +None + +.PARAMETER Byte +None + +.PARAMETER Integer +None + +.PARAMETER Int32 +None + +.PARAMETER Int64 +None + +.PARAMETER Float +None + +.PARAMETER String +None + +.PARAMETER Binary +None + +.PARAMETER Date +None + +.PARAMETER DateTime +None + +.PARAMETER Password +None + +.PARAMETER Callback +None + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +None +#> +function Test-PSEndpointParameters { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [Decimal] + ${Number}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [Double] + ${Double}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${PatternWithoutDelimiter}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [SystemByte] + ${Byte}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Int32]] + ${Integer}, + [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Int32]] + ${Int32}, + [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Int64]] + ${Int64}, + [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Double]] + ${Float}, + [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${String}, + [Parameter(Position = 9, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.IO.FileInfo] + ${Binary}, + [Parameter(Position = 10, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[System.DateTime]] + ${Date}, + [Parameter(Position = 11, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[System.DateTime]] + ${DateTime}, + [Parameter(Position = 12, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${Password}, + [Parameter(Position = 13, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${Callback}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-PSEndpointParameters' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/x-www-form-urlencoded') + + $LocalVarUri = '/fake' + + if ($Integer) { + $LocalVarFormParameters['integer'] = $Integer + } + + if ($Int32) { + $LocalVarFormParameters['int32'] = $Int32 + } + + if ($Int64) { + $LocalVarFormParameters['int64'] = $Int64 + } + + if (!$Number) { + throw "Error! The required parameter `Number` missing when calling testEndpointParameters." + } + $LocalVarFormParameters['number'] = $Number + + if ($Float) { + $LocalVarFormParameters['float'] = $Float + } + + if (!$Double) { + throw "Error! The required parameter `Double` missing when calling testEndpointParameters." + } + $LocalVarFormParameters['double'] = $Double + + if ($String) { + $LocalVarFormParameters['string'] = $String + } + + if (!$PatternWithoutDelimiter) { + throw "Error! The required parameter `PatternWithoutDelimiter` missing when calling testEndpointParameters." + } + $LocalVarFormParameters['pattern_without_delimiter'] = $PatternWithoutDelimiter + + if (!$Byte) { + throw "Error! The required parameter `Byte` missing when calling testEndpointParameters." + } + $LocalVarFormParameters['byte'] = $Byte + + if ($Binary) { + $LocalVarFormParameters['binary'] = $Binary + } + + if ($Date) { + $LocalVarFormParameters['date'] = $Date + } + + if ($DateTime) { + $LocalVarFormParameters['dateTime'] = $DateTime + } + + if ($Password) { + $LocalVarFormParameters['password'] = $Password + } + + if ($Callback) { + $LocalVarFormParameters['callback'] = $Callback + } + + if ($Configuration["Username"] -and $Configuration["Password"]) { + $LocalVarBytes = [System.Text.Encoding]::UTF8.GetBytes($Configuration["Username"] + ":" + $Configuration["Password"]) + $LocalVarBase64Text =[Convert]::ToBase64String($LocalVarBytes) + $LocalVarHeaderParameters['Authorization'] = "Basic " + $LocalVarBase64Text + Write-Verbose ("Using HTTP basic authentication in {0}" -f $MyInvocation.MyCommand) + } + + $LocalVarResult = Invoke-PSApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +To test enum parameters + +.DESCRIPTION + +No description available. + +.PARAMETER EnumHeaderStringArray +Header parameter enum test (string array) + +.PARAMETER EnumHeaderString +Header parameter enum test (string) + +.PARAMETER EnumQueryStringArray +Query parameter enum test (string array) + +.PARAMETER EnumQueryString +Query parameter enum test (string) + +.PARAMETER EnumQueryInteger +Query parameter enum test (double) + +.PARAMETER EnumQueryDouble +Query parameter enum test (double) + +.PARAMETER EnumFormStringArray +Form parameter enum test (string array) + +.PARAMETER EnumFormString +Form parameter enum test (string) + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +None +#> +function Test-PSEnumParameters { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [ValidateSet(">", "$")] + [String[]] + ${EnumHeaderStringArray}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [ValidateSet("_abc", "-efg", "(xyz)")] + [String] + ${EnumHeaderString}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [ValidateSet(">", "$")] + [String[]] + ${EnumQueryStringArray}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [ValidateSet("_abc", "-efg", "(xyz)")] + [String] + ${EnumQueryString}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [ValidateSet("1", "-2")] + [System.Nullable[Int32]] + ${EnumQueryInteger}, + [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [ValidateSet("1.1", "-1.2")] + [System.Nullable[Double]] + ${EnumQueryDouble}, + [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [ValidateSet(">", "$")] + [String[]] + ${EnumFormStringArray}, + [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [ValidateSet("_abc", "-efg", "(xyz)")] + [String] + ${EnumFormString}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-PSEnumParameters' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/x-www-form-urlencoded') + + $LocalVarUri = '/fake' + + if ($EnumHeaderStringArray) { + $LocalVarHeaderParameters['enum_header_string_array'] = $EnumHeaderStringArray + } + + if ($EnumHeaderString) { + $LocalVarHeaderParameters['enum_header_string'] = $EnumHeaderString + } + + if ($EnumQueryStringArray) { + $LocalVarQueryParameters['enum_query_string_array'] = $EnumQueryStringArray + } + + if ($EnumQueryString) { + $LocalVarQueryParameters['enum_query_string'] = $EnumQueryString + } + + if ($EnumQueryInteger) { + $LocalVarQueryParameters['enum_query_integer'] = $EnumQueryInteger + } + + if ($EnumQueryDouble) { + $LocalVarQueryParameters['enum_query_double'] = $EnumQueryDouble + } + + if ($EnumFormStringArray) { + $LocalVarFormParameters['enum_form_string_array'] = $EnumFormStringArray + } + + if ($EnumFormString) { + $LocalVarFormParameters['enum_form_string'] = $EnumFormString + } + + $LocalVarResult = Invoke-PSApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Fake endpoint to test group parameters (optional) + +.DESCRIPTION + +No description available. + +.PARAMETER RequiredStringGroup +Required String in group parameters + +.PARAMETER RequiredBooleanGroup +Required Boolean in group parameters + +.PARAMETER RequiredInt64Group +Required Integer in group parameters + +.PARAMETER StringGroup +String in group parameters + +.PARAMETER BooleanGroup +Boolean in group parameters + +.PARAMETER Int64Group +Integer in group parameters + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +None +#> +function Test-PSGroupParameters { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [Int32] + ${RequiredStringGroup}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [Boolean] + ${RequiredBooleanGroup}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [Int64] + ${RequiredInt64Group}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Int32]] + ${StringGroup}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Boolean]] + ${BooleanGroup}, + [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Int64]] + ${Int64Group}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-PSGroupParameters' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + $LocalVarUri = '/fake' + + if (!$RequiredBooleanGroup) { + throw "Error! The required parameter `RequiredBooleanGroup` missing when calling testGroupParameters." + } + $LocalVarHeaderParameters['required_boolean_group'] = $RequiredBooleanGroup + + if ($BooleanGroup) { + $LocalVarHeaderParameters['boolean_group'] = $BooleanGroup + } + + if (!$RequiredStringGroup) { + throw "Error! The required parameter `RequiredStringGroup` missing when calling testGroupParameters." + } + $LocalVarQueryParameters['required_string_group'] = $RequiredStringGroup + + if (!$RequiredInt64Group) { + throw "Error! The required parameter `RequiredInt64Group` missing when calling testGroupParameters." + } + $LocalVarQueryParameters['required_int64_group'] = $RequiredInt64Group + + if ($StringGroup) { + $LocalVarQueryParameters['string_group'] = $StringGroup + } + + if ($Int64Group) { + $LocalVarQueryParameters['int64_group'] = $Int64Group + } + + if ($Configuration["AccessToken"]) { + $LocalVarHeaderParameters['Authorization'] = "Bearer " + $Configuration["AccessToken"] + Write-Verbose ("Using Bearer authentication in {0}" -f $MyInvocation.MyCommand) + } + + $LocalVarResult = Invoke-PSApiClient -Method 'DELETE' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +test inline additionalProperties + +.DESCRIPTION + +No description available. + +.PARAMETER RequestBody +request body + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +None +#> +function Test-PSInlineAdditionalProperties { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Collections.Hashtable] + ${RequestBody}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-PSInlineAdditionalProperties' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/fake/inline-additionalProperties' + + if (!$RequestBody) { + throw "Error! The required parameter `RequestBody` missing when calling testInlineAdditionalProperties." + } + + $LocalVarBodyParameter = $RequestBody | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-PSApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +test json serialization of form data + +.DESCRIPTION + +No description available. + +.PARAMETER Param +field1 + +.PARAMETER Param2 +field2 + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +None +#> +function Test-PSJsonFormData { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${Param}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${Param2}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-PSJsonFormData' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/x-www-form-urlencoded') + + $LocalVarUri = '/fake/jsonFormData' + + if (!$Param) { + throw "Error! The required parameter `Param` missing when calling testJsonFormData." + } + $LocalVarFormParameters['param'] = $Param + + if (!$Param2) { + throw "Error! The required parameter `Param2` missing when calling testJsonFormData." + } + $LocalVarFormParameters['param2'] = $Param2 + + $LocalVarResult = Invoke-PSApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Pipe +No description available. + +.PARAMETER Ioutil +No description available. + +.PARAMETER Http +No description available. + +.PARAMETER Url +No description available. + +.PARAMETER Context +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +None +#> +function Test-PSQueryParameterCollectionFormat { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String[]] + ${Pipe}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String[]] + ${Ioutil}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String[]] + ${Http}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String[]] + ${Url}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String[]] + ${Context}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-PSQueryParameterCollectionFormat' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + $LocalVarUri = '/fake/test-query-parameters' + + if (!$Pipe) { + throw "Error! The required parameter `Pipe` missing when calling testQueryParameterCollectionFormat." + } + $LocalVarQueryParameters['pipe'] = $Pipe + + if (!$Ioutil) { + throw "Error! The required parameter `Ioutil` missing when calling testQueryParameterCollectionFormat." + } + $LocalVarQueryParameters['ioutil'] = $Ioutil + + if (!$Http) { + throw "Error! The required parameter `Http` missing when calling testQueryParameterCollectionFormat." + } + $LocalVarQueryParameters['http'] = $Http + + if (!$Url) { + throw "Error! The required parameter `Url` missing when calling testQueryParameterCollectionFormat." + } + $LocalVarQueryParameters['url'] = $Url + + if (!$Context) { + throw "Error! The required parameter `Context` missing when calling testQueryParameterCollectionFormat." + } + $LocalVarQueryParameters['context'] = $Context + + $LocalVarResult = Invoke-PSApiClient -Method 'PUT' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeClassnameTags123Api.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeClassnameTags123Api.ps1 new file mode 100644 index 000000000000..35f1186fcce4 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeClassnameTags123Api.ps1 @@ -0,0 +1,90 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +To test class name in snake case + +.DESCRIPTION + +No description available. + +.PARAMETER Client +client model + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +Client +#> +function Test-PSClassname { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${Client}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-PSClassname' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('application/json') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/fake_classname_test' + + if (!$Client) { + throw "Error! The required parameter `Client` missing when calling testClassname." + } + + $LocalVarBodyParameter = $Client | ConvertTo-Json -Depth 100 + + if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["api_key_query"]) { + $LocalVarQueryParameters['api_key_query'] = $Configuration["ApiKey"]["api_key_query"] + Write-Verbose ("Using API key `api_key_query` in the URL query for authentication in {0}" -f $MyInvocation.MyCommand) + } + + $LocalVarResult = Invoke-PSApiClient -Method 'PATCH' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "Client" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1 index b6c13d19fb19..3542112c914d 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -17,17 +17,13 @@ No description available. .PARAMETER Pet Pet object that needs to be added to the store -.PARAMETER ReturnType - -Select the return type (optional): application/xml, application/json - .PARAMETER WithHttpInfo A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response .OUTPUTS -Pet +None #> function Add-PSPet { [CmdletBinding()] @@ -35,9 +31,6 @@ function Add-PSPet { [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [PSCustomObject] ${Pet}, - [String] - [ValidateSet("application/xml", "application/json")] - $ReturnType, [Switch] $WithHttpInfo ) @@ -56,14 +49,6 @@ function Add-PSPet { $LocalVarBodyParameter = $null $Configuration = Get-PSConfiguration - # HTTP header 'Accept' (if needed) - $LocalVarAccepts = @('application/xml', 'application/json') - - if ($ReturnType) { - # use the return type (MIME) provided by the user - $LocalVarAccepts = @($ReturnType) - } - # HTTP header 'Content-Type' $LocalVarContentTypes = @('application/json', 'application/xml') @@ -76,6 +61,7 @@ function Add-PSPet { $LocalVarBodyParameter = $Pet | ConvertTo-Json -Depth 100 + $LocalVarResult = Invoke-PSApiClient -Method 'POST' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` @@ -85,7 +71,7 @@ function Add-PSPet { -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` - -ReturnType "Pet" ` + -ReturnType "" ` -IsBodyNullable $false if ($WithHttpInfo.IsPresent) { @@ -245,6 +231,7 @@ function Find-PSPetsByStatus { $LocalVarQueryParameters['status'] = $Status + $LocalVarResult = Invoke-PSApiClient -Method 'GET' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` @@ -332,6 +319,7 @@ function Find-PSPetsByTags { $LocalVarQueryParameters['tags'] = $Tags + $LocalVarResult = Invoke-PSApiClient -Method 'GET' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` @@ -454,17 +442,13 @@ No description available. .PARAMETER Pet Pet object that needs to be added to the store -.PARAMETER ReturnType - -Select the return type (optional): application/xml, application/json - .PARAMETER WithHttpInfo A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response .OUTPUTS -Pet +None #> function Update-PSPet { [CmdletBinding()] @@ -472,9 +456,6 @@ function Update-PSPet { [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [PSCustomObject] ${Pet}, - [String] - [ValidateSet("application/xml", "application/json")] - $ReturnType, [Switch] $WithHttpInfo ) @@ -493,14 +474,6 @@ function Update-PSPet { $LocalVarBodyParameter = $null $Configuration = Get-PSConfiguration - # HTTP header 'Accept' (if needed) - $LocalVarAccepts = @('application/xml', 'application/json') - - if ($ReturnType) { - # use the return type (MIME) provided by the user - $LocalVarAccepts = @($ReturnType) - } - # HTTP header 'Content-Type' $LocalVarContentTypes = @('application/json', 'application/xml') @@ -513,6 +486,7 @@ function Update-PSPet { $LocalVarBodyParameter = $Pet | ConvertTo-Json -Depth 100 + $LocalVarResult = Invoke-PSApiClient -Method 'PUT' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` @@ -522,7 +496,7 @@ function Update-PSPet { -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` - -ReturnType "Pet" ` + -ReturnType "" ` -IsBodyNullable $false if ($WithHttpInfo.IsPresent) { @@ -724,3 +698,101 @@ function Invoke-PSUploadFile { } } +<# +.SYNOPSIS + +uploads an image (required) + +.DESCRIPTION + +No description available. + +.PARAMETER PetId +ID of pet to update + +.PARAMETER RequiredFile +file to upload + +.PARAMETER AdditionalMetadata +Additional data to pass to server + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +ApiResponse +#> +function Invoke-PSUploadFileWithRequiredFile { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [Int64] + ${PetId}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.IO.FileInfo] + ${RequiredFile}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${AdditionalMetadata}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Invoke-PSUploadFileWithRequiredFile' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('application/json') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('multipart/form-data') + + $LocalVarUri = '/fake/{petId}/uploadImageWithRequiredFile' + if (!$PetId) { + throw "Error! The required parameter `PetId` missing when calling uploadFileWithRequiredFile." + } + $LocalVarUri = $LocalVarUri.replace('{petId}', [System.Web.HTTPUtility]::UrlEncode($PetId)) + + if ($AdditionalMetadata) { + $LocalVarFormParameters['additionalMetadata'] = $AdditionalMetadata + } + + if (!$RequiredFile) { + throw "Error! The required parameter `RequiredFile` missing when calling uploadFileWithRequiredFile." + } + $LocalVarFormParameters['requiredFile'] = $RequiredFile + + + $LocalVarResult = Invoke-PSApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "ApiResponse" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSStoreApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSStoreApi.ps1 index da64d177edd3..a0f88138a48d 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Api/PSStoreApi.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSStoreApi.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -49,11 +49,11 @@ function Remove-PSOrder { $LocalVarBodyParameter = $null $Configuration = Get-PSConfiguration - $LocalVarUri = '/store/order/{orderId}' + $LocalVarUri = '/store/order/{order_id}' if (!$OrderId) { throw "Error! The required parameter `OrderId` missing when calling deleteOrder." } - $LocalVarUri = $LocalVarUri.replace('{orderId}', [System.Web.HTTPUtility]::UrlEncode($OrderId)) + $LocalVarUri = $LocalVarUri.replace('{order_id}', [System.Web.HTTPUtility]::UrlEncode($OrderId)) $LocalVarResult = Invoke-PSApiClient -Method 'DELETE' ` -Uri $LocalVarUri ` @@ -202,11 +202,11 @@ function Get-PSOrderById { $LocalVarAccepts = @($ReturnType) } - $LocalVarUri = '/store/order/{orderId}' + $LocalVarUri = '/store/order/{order_id}' if (!$OrderId) { throw "Error! The required parameter `OrderId` missing when calling getOrderById." } - $LocalVarUri = $LocalVarUri.replace('{orderId}', [System.Web.HTTPUtility]::UrlEncode($OrderId)) + $LocalVarUri = $LocalVarUri.replace('{order_id}', [System.Web.HTTPUtility]::UrlEncode($OrderId)) $LocalVarResult = Invoke-PSApiClient -Method 'GET' ` -Uri $LocalVarUri ` diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSUserApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSUserApi.ps1 index b1bf3241a100..6d3be8f1037e 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Api/PSUserApi.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSUserApi.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -60,11 +60,6 @@ function New-PSUser { $LocalVarBodyParameter = $User | ConvertTo-Json -Depth 100 - if ($Configuration["Cookie"]) { - $LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"] - Write-Verbose ("Using API key `auth_cookie` in the cookie for authentication in {0}" -f $MyInvocation.MyCommand) - } - $LocalVarResult = Invoke-PSApiClient -Method 'POST' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` @@ -140,11 +135,6 @@ function New-PSUsersWithArrayInput { $LocalVarBodyParameter = $User | ConvertTo-Json -Depth 100 - if ($Configuration["Cookie"]) { - $LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"] - Write-Verbose ("Using API key `auth_cookie` in the cookie for authentication in {0}" -f $MyInvocation.MyCommand) - } - $LocalVarResult = Invoke-PSApiClient -Method 'POST' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` @@ -220,11 +210,6 @@ function New-PSUsersWithListInput { $LocalVarBodyParameter = $User | ConvertTo-Json -Depth 100 - if ($Configuration["Cookie"]) { - $LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"] - Write-Verbose ("Using API key `auth_cookie` in the cookie for authentication in {0}" -f $MyInvocation.MyCommand) - } - $LocalVarResult = Invoke-PSApiClient -Method 'POST' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` @@ -295,11 +280,6 @@ function Remove-PSUser { } $LocalVarUri = $LocalVarUri.replace('{username}', [System.Web.HTTPUtility]::UrlEncode($Username)) - if ($Configuration["Cookie"]) { - $LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"] - Write-Verbose ("Using API key `auth_cookie` in the cookie for authentication in {0}" -f $MyInvocation.MyCommand) - } - $LocalVarResult = Invoke-PSApiClient -Method 'DELETE' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` @@ -542,11 +522,6 @@ function Invoke-PSLogoutUser { $Configuration = Get-PSConfiguration $LocalVarUri = '/user/logout' - if ($Configuration["Cookie"]) { - $LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"] - Write-Verbose ("Using API key `auth_cookie` in the cookie for authentication in {0}" -f $MyInvocation.MyCommand) - } - $LocalVarResult = Invoke-PSApiClient -Method 'GET' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` @@ -632,11 +607,6 @@ function Update-PSUser { $LocalVarBodyParameter = $User | ConvertTo-Json -Depth 100 - if ($Configuration["Cookie"]) { - $LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"] - Write-Verbose ("Using API key `auth_cookie` in the cookie for authentication in {0}" -f $MyInvocation.MyCommand) - } - $LocalVarResult = Invoke-PSApiClient -Method 'PUT' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` diff --git a/samples/client/petstore/powershell/src/PSPetstore/Client/PSConfiguration.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Client/PSConfiguration.ps1 index d24a405660da..d655e6f997b2 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Client/PSConfiguration.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Client/PSConfiguration.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -347,6 +347,10 @@ function Get-PSHostSetting { ) } } + }, + @{ + "Url" = "https://127.0.0.1/no_variable"; + "Description" = "The local server without variables"; } ) diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/AdditionalPropertiesClass.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/AdditionalPropertiesClass.ps1 new file mode 100644 index 000000000000..517281366f80 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/AdditionalPropertiesClass.ps1 @@ -0,0 +1,188 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER MapProperty +No description available. +.PARAMETER MapOfMapProperty +No description available. +.PARAMETER Anytype1 +No description available. +.PARAMETER MapWithUndeclaredPropertiesAnytype1 +No description available. +.PARAMETER MapWithUndeclaredPropertiesAnytype2 +No description available. +.PARAMETER MapWithUndeclaredPropertiesAnytype3 +No description available. +.PARAMETER EmptyMap +an object with no declared properties and no undeclared properties, hence it's an empty map. +.PARAMETER MapWithUndeclaredPropertiesString +No description available. +.OUTPUTS + +AdditionalPropertiesClass +#> + +function Initialize-PSAdditionalPropertiesClass { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Collections.Hashtable] + ${MapProperty}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [System.Collections.Hashtable] + ${MapOfMapProperty}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${Anytype1}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${MapWithUndeclaredPropertiesAnytype1}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${MapWithUndeclaredPropertiesAnytype2}, + [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] + [System.Collections.Hashtable] + ${MapWithUndeclaredPropertiesAnytype3}, + [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${EmptyMap}, + [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)] + [System.Collections.Hashtable] + ${MapWithUndeclaredPropertiesString} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSAdditionalPropertiesClass' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "map_property" = ${MapProperty} + "map_of_map_property" = ${MapOfMapProperty} + "anytype_1" = ${Anytype1} + "map_with_undeclared_properties_anytype_1" = ${MapWithUndeclaredPropertiesAnytype1} + "map_with_undeclared_properties_anytype_2" = ${MapWithUndeclaredPropertiesAnytype2} + "map_with_undeclared_properties_anytype_3" = ${MapWithUndeclaredPropertiesAnytype3} + "empty_map" = ${EmptyMap} + "map_with_undeclared_properties_string" = ${MapWithUndeclaredPropertiesString} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to AdditionalPropertiesClass + +.DESCRIPTION + +Convert from JSON to AdditionalPropertiesClass + +.PARAMETER Json + +Json object + +.OUTPUTS + +AdditionalPropertiesClass +#> +function ConvertFrom-PSJsonToAdditionalPropertiesClass { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSAdditionalPropertiesClass' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSAdditionalPropertiesClass + $AllProperties = ("map_property", "map_of_map_property", "anytype_1", "map_with_undeclared_properties_anytype_1", "map_with_undeclared_properties_anytype_2", "map_with_undeclared_properties_anytype_3", "empty_map", "map_with_undeclared_properties_string") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "map_property"))) { #optional property not found + $MapProperty = $null + } else { + $MapProperty = $JsonParameters.PSobject.Properties["map_property"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "map_of_map_property"))) { #optional property not found + $MapOfMapProperty = $null + } else { + $MapOfMapProperty = $JsonParameters.PSobject.Properties["map_of_map_property"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "anytype_1"))) { #optional property not found + $Anytype1 = $null + } else { + $Anytype1 = $JsonParameters.PSobject.Properties["anytype_1"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "map_with_undeclared_properties_anytype_1"))) { #optional property not found + $MapWithUndeclaredPropertiesAnytype1 = $null + } else { + $MapWithUndeclaredPropertiesAnytype1 = $JsonParameters.PSobject.Properties["map_with_undeclared_properties_anytype_1"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "map_with_undeclared_properties_anytype_2"))) { #optional property not found + $MapWithUndeclaredPropertiesAnytype2 = $null + } else { + $MapWithUndeclaredPropertiesAnytype2 = $JsonParameters.PSobject.Properties["map_with_undeclared_properties_anytype_2"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "map_with_undeclared_properties_anytype_3"))) { #optional property not found + $MapWithUndeclaredPropertiesAnytype3 = $null + } else { + $MapWithUndeclaredPropertiesAnytype3 = $JsonParameters.PSobject.Properties["map_with_undeclared_properties_anytype_3"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "empty_map"))) { #optional property not found + $EmptyMap = $null + } else { + $EmptyMap = $JsonParameters.PSobject.Properties["empty_map"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "map_with_undeclared_properties_string"))) { #optional property not found + $MapWithUndeclaredPropertiesString = $null + } else { + $MapWithUndeclaredPropertiesString = $JsonParameters.PSobject.Properties["map_with_undeclared_properties_string"].value + } + + $PSO = [PSCustomObject]@{ + "map_property" = ${MapProperty} + "map_of_map_property" = ${MapOfMapProperty} + "anytype_1" = ${Anytype1} + "map_with_undeclared_properties_anytype_1" = ${MapWithUndeclaredPropertiesAnytype1} + "map_with_undeclared_properties_anytype_2" = ${MapWithUndeclaredPropertiesAnytype2} + "map_with_undeclared_properties_anytype_3" = ${MapWithUndeclaredPropertiesAnytype3} + "empty_map" = ${EmptyMap} + "map_with_undeclared_properties_string" = ${MapWithUndeclaredPropertiesString} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Animal.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Animal.ps1 new file mode 100644 index 000000000000..1da516f041bf --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Animal.ps1 @@ -0,0 +1,118 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ClassName +No description available. +.PARAMETER Color +No description available. +.OUTPUTS + +Animal +#> + +function Initialize-PSAnimal { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${ClassName}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${Color} = "red" + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSAnimal' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $ClassName) { + throw "invalid value for 'ClassName', 'ClassName' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "className" = ${ClassName} + "color" = ${Color} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Animal + +.DESCRIPTION + +Convert from JSON to Animal + +.PARAMETER Json + +Json object + +.OUTPUTS + +Animal +#> +function ConvertFrom-PSJsonToAnimal { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSAnimal' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSAnimal + $AllProperties = ("className", "color") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'className' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "className"))) { + throw "Error! JSON cannot be serialized due to the required property 'className' missing." + } else { + $ClassName = $JsonParameters.PSobject.Properties["className"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "color"))) { #optional property not found + $Color = $null + } else { + $Color = $JsonParameters.PSobject.Properties["color"].value + } + + $PSO = [PSCustomObject]@{ + "className" = ${ClassName} + "color" = ${Color} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/ApiResponse.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/ApiResponse.ps1 index 44be11154a37..4569b4ce4501 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Model/ApiResponse.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/ApiResponse.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -12,7 +12,7 @@ No summary available. .DESCRIPTION -Describes the result of uploading an image resource +No description available. .PARAMETER Code No description available. diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Apple.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Apple.ps1 new file mode 100644 index 000000000000..049bfec4495d --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Apple.ps1 @@ -0,0 +1,112 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Cultivar +No description available. +.PARAMETER Origin +No description available. +.OUTPUTS + +Apple +#> + +function Initialize-PSApple { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [ValidatePattern("^[a-zA-Z\s]*$")] + [String] + ${Cultivar}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [ValidatePattern("/^[A-Z\s]*$/i")] + [String] + ${Origin} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSApple' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "cultivar" = ${Cultivar} + "origin" = ${Origin} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Apple + +.DESCRIPTION + +Convert from JSON to Apple + +.PARAMETER Json + +Json object + +.OUTPUTS + +Apple +#> +function ConvertFrom-PSJsonToApple { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSApple' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSApple + $AllProperties = ("cultivar", "origin") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "cultivar"))) { #optional property not found + $Cultivar = $null + } else { + $Cultivar = $JsonParameters.PSobject.Properties["cultivar"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "origin"))) { #optional property not found + $Origin = $null + } else { + $Origin = $JsonParameters.PSobject.Properties["origin"].value + } + + $PSO = [PSCustomObject]@{ + "cultivar" = ${Cultivar} + "origin" = ${Origin} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/AppleReq.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/AppleReq.ps1 new file mode 100644 index 000000000000..10604433c184 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/AppleReq.ps1 @@ -0,0 +1,118 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Cultivar +No description available. +.PARAMETER Mealy +No description available. +.OUTPUTS + +AppleReq +#> + +function Initialize-PSAppleReq { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Cultivar}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Boolean]] + ${Mealy} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSAppleReq' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $Cultivar) { + throw "invalid value for 'Cultivar', 'Cultivar' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "cultivar" = ${Cultivar} + "mealy" = ${Mealy} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to AppleReq + +.DESCRIPTION + +Convert from JSON to AppleReq + +.PARAMETER Json + +Json object + +.OUTPUTS + +AppleReq +#> +function ConvertFrom-PSJsonToAppleReq { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSAppleReq' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSAppleReq + $AllProperties = ("cultivar", "mealy") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'cultivar' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "cultivar"))) { + throw "Error! JSON cannot be serialized due to the required property 'cultivar' missing." + } else { + $Cultivar = $JsonParameters.PSobject.Properties["cultivar"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "mealy"))) { #optional property not found + $Mealy = $null + } else { + $Mealy = $JsonParameters.PSobject.Properties["mealy"].value + } + + $PSO = [PSCustomObject]@{ + "cultivar" = ${Cultivar} + "mealy" = ${Mealy} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/ArrayOfArrayOfNumberOnly.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/ArrayOfArrayOfNumberOnly.ps1 new file mode 100644 index 000000000000..15762b5aef59 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/ArrayOfArrayOfNumberOnly.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ArrayArrayNumber +No description available. +.OUTPUTS + +ArrayOfArrayOfNumberOnly +#> + +function Initialize-PSArrayOfArrayOfNumberOnly { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [Decimal[][]] + ${ArrayArrayNumber} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSArrayOfArrayOfNumberOnly' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "ArrayArrayNumber" = ${ArrayArrayNumber} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to ArrayOfArrayOfNumberOnly + +.DESCRIPTION + +Convert from JSON to ArrayOfArrayOfNumberOnly + +.PARAMETER Json + +Json object + +.OUTPUTS + +ArrayOfArrayOfNumberOnly +#> +function ConvertFrom-PSJsonToArrayOfArrayOfNumberOnly { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSArrayOfArrayOfNumberOnly' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSArrayOfArrayOfNumberOnly + $AllProperties = ("ArrayArrayNumber") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "ArrayArrayNumber"))) { #optional property not found + $ArrayArrayNumber = $null + } else { + $ArrayArrayNumber = $JsonParameters.PSobject.Properties["ArrayArrayNumber"].value + } + + $PSO = [PSCustomObject]@{ + "ArrayArrayNumber" = ${ArrayArrayNumber} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/ArrayOfNumberOnly.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/ArrayOfNumberOnly.ps1 new file mode 100644 index 000000000000..d952e5e914a7 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/ArrayOfNumberOnly.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ArrayNumber +No description available. +.OUTPUTS + +ArrayOfNumberOnly +#> + +function Initialize-PSArrayOfNumberOnly { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [Decimal[]] + ${ArrayNumber} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSArrayOfNumberOnly' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "ArrayNumber" = ${ArrayNumber} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to ArrayOfNumberOnly + +.DESCRIPTION + +Convert from JSON to ArrayOfNumberOnly + +.PARAMETER Json + +Json object + +.OUTPUTS + +ArrayOfNumberOnly +#> +function ConvertFrom-PSJsonToArrayOfNumberOnly { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSArrayOfNumberOnly' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSArrayOfNumberOnly + $AllProperties = ("ArrayNumber") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "ArrayNumber"))) { #optional property not found + $ArrayNumber = $null + } else { + $ArrayNumber = $JsonParameters.PSobject.Properties["ArrayNumber"].value + } + + $PSO = [PSCustomObject]@{ + "ArrayNumber" = ${ArrayNumber} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/ArrayTest.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/ArrayTest.ps1 new file mode 100644 index 000000000000..bd20031b93a2 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/ArrayTest.ps1 @@ -0,0 +1,123 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ArrayOfString +No description available. +.PARAMETER ArrayArrayOfInteger +No description available. +.PARAMETER ArrayArrayOfModel +No description available. +.OUTPUTS + +ArrayTest +#> + +function Initialize-PSArrayTest { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String[]] + ${ArrayOfString}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [Int64[][]] + ${ArrayArrayOfInteger}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject[][]] + ${ArrayArrayOfModel} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSArrayTest' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "array_of_string" = ${ArrayOfString} + "array_array_of_integer" = ${ArrayArrayOfInteger} + "array_array_of_model" = ${ArrayArrayOfModel} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to ArrayTest + +.DESCRIPTION + +Convert from JSON to ArrayTest + +.PARAMETER Json + +Json object + +.OUTPUTS + +ArrayTest +#> +function ConvertFrom-PSJsonToArrayTest { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSArrayTest' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSArrayTest + $AllProperties = ("array_of_string", "array_array_of_integer", "array_array_of_model") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_of_string"))) { #optional property not found + $ArrayOfString = $null + } else { + $ArrayOfString = $JsonParameters.PSobject.Properties["array_of_string"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_array_of_integer"))) { #optional property not found + $ArrayArrayOfInteger = $null + } else { + $ArrayArrayOfInteger = $JsonParameters.PSobject.Properties["array_array_of_integer"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_array_of_model"))) { #optional property not found + $ArrayArrayOfModel = $null + } else { + $ArrayArrayOfModel = $JsonParameters.PSobject.Properties["array_array_of_model"].value + } + + $PSO = [PSCustomObject]@{ + "array_of_string" = ${ArrayOfString} + "array_array_of_integer" = ${ArrayArrayOfInteger} + "array_array_of_model" = ${ArrayArrayOfModel} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Banana.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Banana.ps1 new file mode 100644 index 000000000000..55e9a55978fa --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Banana.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER LengthCm +No description available. +.OUTPUTS + +Banana +#> + +function Initialize-PSBanana { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Decimal]] + ${LengthCm} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSBanana' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "lengthCm" = ${LengthCm} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Banana + +.DESCRIPTION + +Convert from JSON to Banana + +.PARAMETER Json + +Json object + +.OUTPUTS + +Banana +#> +function ConvertFrom-PSJsonToBanana { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSBanana' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSBanana + $AllProperties = ("lengthCm") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "lengthCm"))) { #optional property not found + $LengthCm = $null + } else { + $LengthCm = $JsonParameters.PSobject.Properties["lengthCm"].value + } + + $PSO = [PSCustomObject]@{ + "lengthCm" = ${LengthCm} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/BananaReq.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/BananaReq.ps1 new file mode 100644 index 000000000000..21dee7f98766 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/BananaReq.ps1 @@ -0,0 +1,118 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER LengthCm +No description available. +.PARAMETER Sweet +No description available. +.OUTPUTS + +BananaReq +#> + +function Initialize-PSBananaReq { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [Decimal] + ${LengthCm}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Boolean]] + ${Sweet} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSBananaReq' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $LengthCm) { + throw "invalid value for 'LengthCm', 'LengthCm' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "lengthCm" = ${LengthCm} + "sweet" = ${Sweet} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to BananaReq + +.DESCRIPTION + +Convert from JSON to BananaReq + +.PARAMETER Json + +Json object + +.OUTPUTS + +BananaReq +#> +function ConvertFrom-PSJsonToBananaReq { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSBananaReq' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSBananaReq + $AllProperties = ("lengthCm", "sweet") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'lengthCm' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "lengthCm"))) { + throw "Error! JSON cannot be serialized due to the required property 'lengthCm' missing." + } else { + $LengthCm = $JsonParameters.PSobject.Properties["lengthCm"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "sweet"))) { #optional property not found + $Sweet = $null + } else { + $Sweet = $JsonParameters.PSobject.Properties["sweet"].value + } + + $PSO = [PSCustomObject]@{ + "lengthCm" = ${LengthCm} + "sweet" = ${Sweet} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/BasquePig.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/BasquePig.ps1 new file mode 100644 index 000000000000..d6bfff878420 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/BasquePig.ps1 @@ -0,0 +1,105 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ClassName +No description available. +.OUTPUTS + +BasquePig +#> + +function Initialize-PSBasquePig { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${ClassName} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSBasquePig' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $ClassName) { + throw "invalid value for 'ClassName', 'ClassName' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "className" = ${ClassName} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to BasquePig + +.DESCRIPTION + +Convert from JSON to BasquePig + +.PARAMETER Json + +Json object + +.OUTPUTS + +BasquePig +#> +function ConvertFrom-PSJsonToBasquePig { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSBasquePig' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSBasquePig + $AllProperties = ("className") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'className' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "className"))) { + throw "Error! JSON cannot be serialized due to the required property 'className' missing." + } else { + $ClassName = $JsonParameters.PSobject.Properties["className"].value + } + + $PSO = [PSCustomObject]@{ + "className" = ${ClassName} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Capitalization.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Capitalization.ps1 new file mode 100644 index 000000000000..d71810788fd3 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Capitalization.ps1 @@ -0,0 +1,162 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER SmallCamel +No description available. +.PARAMETER CapitalCamel +No description available. +.PARAMETER SmallSnake +No description available. +.PARAMETER CapitalSnake +No description available. +.PARAMETER SCAETHFlowPoints +No description available. +.PARAMETER ATTNAME +Name of the pet +.OUTPUTS + +Capitalization +#> + +function Initialize-PSCapitalization { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${SmallCamel}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${CapitalCamel}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [String] + ${SmallSnake}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [String] + ${CapitalSnake}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] + [String] + ${SCAETHFlowPoints}, + [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] + [String] + ${ATTNAME} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSCapitalization' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "smallCamel" = ${SmallCamel} + "CapitalCamel" = ${CapitalCamel} + "small_Snake" = ${SmallSnake} + "Capital_Snake" = ${CapitalSnake} + "SCA_ETH_Flow_Points" = ${SCAETHFlowPoints} + "ATT_NAME" = ${ATTNAME} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Capitalization + +.DESCRIPTION + +Convert from JSON to Capitalization + +.PARAMETER Json + +Json object + +.OUTPUTS + +Capitalization +#> +function ConvertFrom-PSJsonToCapitalization { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSCapitalization' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSCapitalization + $AllProperties = ("smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "smallCamel"))) { #optional property not found + $SmallCamel = $null + } else { + $SmallCamel = $JsonParameters.PSobject.Properties["smallCamel"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "CapitalCamel"))) { #optional property not found + $CapitalCamel = $null + } else { + $CapitalCamel = $JsonParameters.PSobject.Properties["CapitalCamel"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "small_Snake"))) { #optional property not found + $SmallSnake = $null + } else { + $SmallSnake = $JsonParameters.PSobject.Properties["small_Snake"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "Capital_Snake"))) { #optional property not found + $CapitalSnake = $null + } else { + $CapitalSnake = $JsonParameters.PSobject.Properties["Capital_Snake"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "SCA_ETH_Flow_Points"))) { #optional property not found + $SCAETHFlowPoints = $null + } else { + $SCAETHFlowPoints = $JsonParameters.PSobject.Properties["SCA_ETH_Flow_Points"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "ATT_NAME"))) { #optional property not found + $ATTNAME = $null + } else { + $ATTNAME = $JsonParameters.PSobject.Properties["ATT_NAME"].value + } + + $PSO = [PSCustomObject]@{ + "smallCamel" = ${SmallCamel} + "CapitalCamel" = ${CapitalCamel} + "small_Snake" = ${SmallSnake} + "Capital_Snake" = ${CapitalSnake} + "SCA_ETH_Flow_Points" = ${SCAETHFlowPoints} + "ATT_NAME" = ${ATTNAME} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Cat.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Cat.ps1 new file mode 100644 index 000000000000..a9c94e32336a --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Cat.ps1 @@ -0,0 +1,131 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ClassName +No description available. +.PARAMETER Color +No description available. +.PARAMETER Declawed +No description available. +.OUTPUTS + +Cat +#> + +function Initialize-PSCat { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${ClassName}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${Color} = "red", + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Boolean]] + ${Declawed} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSCat' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $ClassName) { + throw "invalid value for 'ClassName', 'ClassName' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "className" = ${ClassName} + "color" = ${Color} + "declawed" = ${Declawed} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Cat + +.DESCRIPTION + +Convert from JSON to Cat + +.PARAMETER Json + +Json object + +.OUTPUTS + +Cat +#> +function ConvertFrom-PSJsonToCat { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSCat' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSCat + $AllProperties = ("className", "color", "declawed") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'className' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "className"))) { + throw "Error! JSON cannot be serialized due to the required property 'className' missing." + } else { + $ClassName = $JsonParameters.PSobject.Properties["className"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "color"))) { #optional property not found + $Color = $null + } else { + $Color = $JsonParameters.PSobject.Properties["color"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "declawed"))) { #optional property not found + $Declawed = $null + } else { + $Declawed = $JsonParameters.PSobject.Properties["declawed"].value + } + + $PSO = [PSCustomObject]@{ + "className" = ${ClassName} + "color" = ${Color} + "declawed" = ${Declawed} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/CatAllOf.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/CatAllOf.ps1 new file mode 100644 index 000000000000..1e57f437b5f0 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/CatAllOf.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Declawed +No description available. +.OUTPUTS + +CatAllOf +#> + +function Initialize-PSCatAllOf { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Boolean]] + ${Declawed} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSCatAllOf' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "declawed" = ${Declawed} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to CatAllOf + +.DESCRIPTION + +Convert from JSON to CatAllOf + +.PARAMETER Json + +Json object + +.OUTPUTS + +CatAllOf +#> +function ConvertFrom-PSJsonToCatAllOf { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSCatAllOf' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSCatAllOf + $AllProperties = ("declawed") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "declawed"))) { #optional property not found + $Declawed = $null + } else { + $Declawed = $JsonParameters.PSobject.Properties["declawed"].value + } + + $PSO = [PSCustomObject]@{ + "declawed" = ${Declawed} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Category.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Category.ps1 index 3c3bcf860f9c..2386dd8543c4 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Model/Category.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Category.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -12,7 +12,7 @@ No summary available. .DESCRIPTION -A category for a pet +No description available. .PARAMETER Id No description available. @@ -30,15 +30,18 @@ function Initialize-PSCategory { [System.Nullable[Int64]] ${Id}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] - [ValidatePattern("^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$")] [String] - ${Name} + ${Name} = "default-name" ) Process { 'Creating PSCustomObject: PSPetstore => PSCategory' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug + if ($null -eq $Name) { + throw "invalid value for 'Name', 'Name' cannot be null." + } + $PSO = [PSCustomObject]@{ "id" = ${Id} @@ -87,18 +90,22 @@ function ConvertFrom-PSJsonToCategory { } } - if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) { #optional property not found - $Id = $null - } else { - $Id = $JsonParameters.PSobject.Properties["id"].value + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'name' missing." } - if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) { #optional property not found - $Name = $null + if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) { + throw "Error! JSON cannot be serialized due to the required property 'name' missing." } else { $Name = $JsonParameters.PSobject.Properties["name"].value } + if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) { #optional property not found + $Id = $null + } else { + $Id = $JsonParameters.PSobject.Properties["id"].value + } + $PSO = [PSCustomObject]@{ "id" = ${Id} "name" = ${Name} diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/ClassModel.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/ClassModel.ps1 new file mode 100644 index 000000000000..eea87f4ac57b --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/ClassModel.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +Model for testing model with ""_class"" property + +.PARAMETER Class +No description available. +.OUTPUTS + +ClassModel +#> + +function Initialize-PSClassModel { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Class} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSClassModel' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "_class" = ${Class} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to ClassModel + +.DESCRIPTION + +Convert from JSON to ClassModel + +.PARAMETER Json + +Json object + +.OUTPUTS + +ClassModel +#> +function ConvertFrom-PSJsonToClassModel { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSClassModel' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSClassModel + $AllProperties = ("_class") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "_class"))) { #optional property not found + $Class = $null + } else { + $Class = $JsonParameters.PSobject.Properties["_class"].value + } + + $PSO = [PSCustomObject]@{ + "_class" = ${Class} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Client.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Client.ps1 new file mode 100644 index 000000000000..13059074de64 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Client.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Client +No description available. +.OUTPUTS + +Client +#> + +function Initialize-PSClient { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Client} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSClient' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "client" = ${Client} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Client + +.DESCRIPTION + +Convert from JSON to Client + +.PARAMETER Json + +Json object + +.OUTPUTS + +Client +#> +function ConvertFrom-PSJsonToClient { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSClient' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSClient + $AllProperties = ("client") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "client"))) { #optional property not found + $Client = $null + } else { + $Client = $JsonParameters.PSobject.Properties["client"].value + } + + $PSO = [PSCustomObject]@{ + "client" = ${Client} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/ComplexQuadrilateral.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/ComplexQuadrilateral.ps1 new file mode 100644 index 000000000000..bfa0839116f0 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/ComplexQuadrilateral.ps1 @@ -0,0 +1,122 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ShapeType +No description available. +.PARAMETER QuadrilateralType +No description available. +.OUTPUTS + +ComplexQuadrilateral +#> + +function Initialize-PSComplexQuadrilateral { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${ShapeType}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${QuadrilateralType} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSComplexQuadrilateral' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $ShapeType) { + throw "invalid value for 'ShapeType', 'ShapeType' cannot be null." + } + + if ($null -eq $QuadrilateralType) { + throw "invalid value for 'QuadrilateralType', 'QuadrilateralType' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "shapeType" = ${ShapeType} + "quadrilateralType" = ${QuadrilateralType} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to ComplexQuadrilateral + +.DESCRIPTION + +Convert from JSON to ComplexQuadrilateral + +.PARAMETER Json + +Json object + +.OUTPUTS + +ComplexQuadrilateral +#> +function ConvertFrom-PSJsonToComplexQuadrilateral { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSComplexQuadrilateral' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSComplexQuadrilateral + $AllProperties = ("shapeType", "quadrilateralType") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'shapeType' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "shapeType"))) { + throw "Error! JSON cannot be serialized due to the required property 'shapeType' missing." + } else { + $ShapeType = $JsonParameters.PSobject.Properties["shapeType"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "quadrilateralType"))) { + throw "Error! JSON cannot be serialized due to the required property 'quadrilateralType' missing." + } else { + $QuadrilateralType = $JsonParameters.PSobject.Properties["quadrilateralType"].value + } + + $PSO = [PSCustomObject]@{ + "shapeType" = ${ShapeType} + "quadrilateralType" = ${QuadrilateralType} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/DanishPig.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/DanishPig.ps1 new file mode 100644 index 000000000000..f30268da519c --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/DanishPig.ps1 @@ -0,0 +1,105 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ClassName +No description available. +.OUTPUTS + +DanishPig +#> + +function Initialize-PSDanishPig { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${ClassName} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSDanishPig' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $ClassName) { + throw "invalid value for 'ClassName', 'ClassName' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "className" = ${ClassName} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to DanishPig + +.DESCRIPTION + +Convert from JSON to DanishPig + +.PARAMETER Json + +Json object + +.OUTPUTS + +DanishPig +#> +function ConvertFrom-PSJsonToDanishPig { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSDanishPig' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSDanishPig + $AllProperties = ("className") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'className' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "className"))) { + throw "Error! JSON cannot be serialized due to the required property 'className' missing." + } else { + $ClassName = $JsonParameters.PSobject.Properties["className"].value + } + + $PSO = [PSCustomObject]@{ + "className" = ${ClassName} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/DeprecatedObject.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/DeprecatedObject.ps1 new file mode 100644 index 000000000000..f2a88c0416a5 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/DeprecatedObject.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Name +No description available. +.OUTPUTS + +DeprecatedObject +#> + +function Initialize-PSDeprecatedObject { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Name} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSDeprecatedObject' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "name" = ${Name} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to DeprecatedObject + +.DESCRIPTION + +Convert from JSON to DeprecatedObject + +.PARAMETER Json + +Json object + +.OUTPUTS + +DeprecatedObject +#> +function ConvertFrom-PSJsonToDeprecatedObject { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSDeprecatedObject' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSDeprecatedObject + $AllProperties = ("name") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) { #optional property not found + $Name = $null + } else { + $Name = $JsonParameters.PSobject.Properties["name"].value + } + + $PSO = [PSCustomObject]@{ + "name" = ${Name} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Dog.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Dog.ps1 new file mode 100644 index 000000000000..3e33a6c23e65 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Dog.ps1 @@ -0,0 +1,131 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ClassName +No description available. +.PARAMETER Color +No description available. +.PARAMETER Breed +No description available. +.OUTPUTS + +Dog +#> + +function Initialize-PSDog { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${ClassName}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${Color} = "red", + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [String] + ${Breed} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSDog' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $ClassName) { + throw "invalid value for 'ClassName', 'ClassName' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "className" = ${ClassName} + "color" = ${Color} + "breed" = ${Breed} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Dog + +.DESCRIPTION + +Convert from JSON to Dog + +.PARAMETER Json + +Json object + +.OUTPUTS + +Dog +#> +function ConvertFrom-PSJsonToDog { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSDog' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSDog + $AllProperties = ("className", "color", "breed") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'className' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "className"))) { + throw "Error! JSON cannot be serialized due to the required property 'className' missing." + } else { + $ClassName = $JsonParameters.PSobject.Properties["className"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "color"))) { #optional property not found + $Color = $null + } else { + $Color = $JsonParameters.PSobject.Properties["color"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "breed"))) { #optional property not found + $Breed = $null + } else { + $Breed = $JsonParameters.PSobject.Properties["breed"].value + } + + $PSO = [PSCustomObject]@{ + "className" = ${ClassName} + "color" = ${Color} + "breed" = ${Breed} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/DogAllOf.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/DogAllOf.ps1 new file mode 100644 index 000000000000..7737af53e414 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/DogAllOf.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Breed +No description available. +.OUTPUTS + +DogAllOf +#> + +function Initialize-PSDogAllOf { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Breed} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSDogAllOf' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "breed" = ${Breed} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to DogAllOf + +.DESCRIPTION + +Convert from JSON to DogAllOf + +.PARAMETER Json + +Json object + +.OUTPUTS + +DogAllOf +#> +function ConvertFrom-PSJsonToDogAllOf { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSDogAllOf' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSDogAllOf + $AllProperties = ("breed") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "breed"))) { #optional property not found + $Breed = $null + } else { + $Breed = $JsonParameters.PSobject.Properties["breed"].value + } + + $PSO = [PSCustomObject]@{ + "breed" = ${Breed} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Drawing.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Drawing.ps1 new file mode 100644 index 000000000000..3db24f69486d --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Drawing.ps1 @@ -0,0 +1,136 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER MainShape +No description available. +.PARAMETER ShapeOrNull +No description available. +.PARAMETER NullableShape +No description available. +.PARAMETER Shapes +No description available. +.OUTPUTS + +Drawing +#> + +function Initialize-PSDrawing { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${MainShape}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${ShapeOrNull}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${NullableShape}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject[]] + ${Shapes} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSDrawing' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "mainShape" = ${MainShape} + "shapeOrNull" = ${ShapeOrNull} + "nullableShape" = ${NullableShape} + "shapes" = ${Shapes} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Drawing + +.DESCRIPTION + +Convert from JSON to Drawing + +.PARAMETER Json + +Json object + +.OUTPUTS + +Drawing +#> +function ConvertFrom-PSJsonToDrawing { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSDrawing' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSDrawing + $AllProperties = ("mainShape", "shapeOrNull", "nullableShape", "shapes") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "mainShape"))) { #optional property not found + $MainShape = $null + } else { + $MainShape = $JsonParameters.PSobject.Properties["mainShape"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "shapeOrNull"))) { #optional property not found + $ShapeOrNull = $null + } else { + $ShapeOrNull = $JsonParameters.PSobject.Properties["shapeOrNull"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "nullableShape"))) { #optional property not found + $NullableShape = $null + } else { + $NullableShape = $JsonParameters.PSobject.Properties["nullableShape"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "shapes"))) { #optional property not found + $Shapes = $null + } else { + $Shapes = $JsonParameters.PSobject.Properties["shapes"].value + } + + $PSO = [PSCustomObject]@{ + "mainShape" = ${MainShape} + "shapeOrNull" = ${ShapeOrNull} + "nullableShape" = ${NullableShape} + "shapes" = ${Shapes} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/EnumArrays.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/EnumArrays.ps1 new file mode 100644 index 000000000000..0dc089ae6b4b --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/EnumArrays.ps1 @@ -0,0 +1,112 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER JustSymbol +No description available. +.PARAMETER ArrayEnum +No description available. +.OUTPUTS + +EnumArrays +#> + +function Initialize-PSEnumArrays { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [ValidateSet(">=", "$")] + [String] + ${JustSymbol}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [ValidateSet("fish", "crab")] + [String[]] + ${ArrayEnum} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSEnumArrays' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "just_symbol" = ${JustSymbol} + "array_enum" = ${ArrayEnum} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to EnumArrays + +.DESCRIPTION + +Convert from JSON to EnumArrays + +.PARAMETER Json + +Json object + +.OUTPUTS + +EnumArrays +#> +function ConvertFrom-PSJsonToEnumArrays { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSEnumArrays' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSEnumArrays + $AllProperties = ("just_symbol", "array_enum") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "just_symbol"))) { #optional property not found + $JustSymbol = $null + } else { + $JustSymbol = $JsonParameters.PSobject.Properties["just_symbol"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_enum"))) { #optional property not found + $ArrayEnum = $null + } else { + $ArrayEnum = $JsonParameters.PSobject.Properties["array_enum"].value + } + + $PSO = [PSCustomObject]@{ + "just_symbol" = ${JustSymbol} + "array_enum" = ${ArrayEnum} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/EnumTest.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/EnumTest.ps1 new file mode 100644 index 000000000000..8b9608f1925e --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/EnumTest.ps1 @@ -0,0 +1,175 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER EnumString +No description available. +.PARAMETER EnumStringRequired +No description available. +.PARAMETER EnumInteger +No description available. +.PARAMETER EnumIntegerOnly +No description available. +.PARAMETER EnumNumber +No description available. +.PARAMETER OuterEnum +No description available. +.OUTPUTS + +EnumTest +#> + +function Initialize-PSEnumTest { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [ValidateSet("UPPER", "lower", "")] + [String] + ${EnumString}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [ValidateSet("UPPER", "lower", "")] + [String] + ${EnumStringRequired}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [ValidateSet("1", "-1")] + [System.Nullable[Int32]] + ${EnumInteger}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [ValidateSet("2", "-2")] + [System.Nullable[Int32]] + ${EnumIntegerOnly}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] + [ValidateSet("1.1", "-1.2")] + [System.Nullable[Double]] + ${EnumNumber}, + [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${OuterEnum} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSEnumTest' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $EnumStringRequired) { + throw "invalid value for 'EnumStringRequired', 'EnumStringRequired' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "enum_string" = ${EnumString} + "enum_string_required" = ${EnumStringRequired} + "enum_integer" = ${EnumInteger} + "enum_integer_only" = ${EnumIntegerOnly} + "enum_number" = ${EnumNumber} + "outerEnum" = ${OuterEnum} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to EnumTest + +.DESCRIPTION + +Convert from JSON to EnumTest + +.PARAMETER Json + +Json object + +.OUTPUTS + +EnumTest +#> +function ConvertFrom-PSJsonToEnumTest { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSEnumTest' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSEnumTest + $AllProperties = ("enum_string", "enum_string_required", "enum_integer", "enum_integer_only", "enum_number", "outerEnum") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'enum_string_required' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "enum_string_required"))) { + throw "Error! JSON cannot be serialized due to the required property 'enum_string_required' missing." + } else { + $EnumStringRequired = $JsonParameters.PSobject.Properties["enum_string_required"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "enum_string"))) { #optional property not found + $EnumString = $null + } else { + $EnumString = $JsonParameters.PSobject.Properties["enum_string"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "enum_integer"))) { #optional property not found + $EnumInteger = $null + } else { + $EnumInteger = $JsonParameters.PSobject.Properties["enum_integer"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "enum_integer_only"))) { #optional property not found + $EnumIntegerOnly = $null + } else { + $EnumIntegerOnly = $JsonParameters.PSobject.Properties["enum_integer_only"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "enum_number"))) { #optional property not found + $EnumNumber = $null + } else { + $EnumNumber = $JsonParameters.PSobject.Properties["enum_number"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "outerEnum"))) { #optional property not found + $OuterEnum = $null + } else { + $OuterEnum = $JsonParameters.PSobject.Properties["outerEnum"].value + } + + $PSO = [PSCustomObject]@{ + "enum_string" = ${EnumString} + "enum_string_required" = ${EnumStringRequired} + "enum_integer" = ${EnumInteger} + "enum_integer_only" = ${EnumIntegerOnly} + "enum_number" = ${EnumNumber} + "outerEnum" = ${OuterEnum} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/EquilateralTriangle.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/EquilateralTriangle.ps1 new file mode 100644 index 000000000000..68d1536147f1 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/EquilateralTriangle.ps1 @@ -0,0 +1,122 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ShapeType +No description available. +.PARAMETER TriangleType +No description available. +.OUTPUTS + +EquilateralTriangle +#> + +function Initialize-PSEquilateralTriangle { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${ShapeType}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${TriangleType} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSEquilateralTriangle' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $ShapeType) { + throw "invalid value for 'ShapeType', 'ShapeType' cannot be null." + } + + if ($null -eq $TriangleType) { + throw "invalid value for 'TriangleType', 'TriangleType' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "shapeType" = ${ShapeType} + "triangleType" = ${TriangleType} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to EquilateralTriangle + +.DESCRIPTION + +Convert from JSON to EquilateralTriangle + +.PARAMETER Json + +Json object + +.OUTPUTS + +EquilateralTriangle +#> +function ConvertFrom-PSJsonToEquilateralTriangle { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSEquilateralTriangle' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSEquilateralTriangle + $AllProperties = ("shapeType", "triangleType") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'shapeType' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "shapeType"))) { + throw "Error! JSON cannot be serialized due to the required property 'shapeType' missing." + } else { + $ShapeType = $JsonParameters.PSobject.Properties["shapeType"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "triangleType"))) { + throw "Error! JSON cannot be serialized due to the required property 'triangleType' missing." + } else { + $TriangleType = $JsonParameters.PSobject.Properties["triangleType"].value + } + + $PSO = [PSCustomObject]@{ + "shapeType" = ${ShapeType} + "triangleType" = ${TriangleType} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/File.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/File.ps1 new file mode 100644 index 000000000000..b9531e65f9cb --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/File.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +Must be named `File` for test. + +.PARAMETER SourceURI +Test capitalization +.OUTPUTS + +File +#> + +function Initialize-PSFile { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${SourceURI} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSFile' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "sourceURI" = ${SourceURI} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to File + +.DESCRIPTION + +Convert from JSON to File + +.PARAMETER Json + +Json object + +.OUTPUTS + +File +#> +function ConvertFrom-PSJsonToFile { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSFile' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSFile + $AllProperties = ("sourceURI") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "sourceURI"))) { #optional property not found + $SourceURI = $null + } else { + $SourceURI = $JsonParameters.PSobject.Properties["sourceURI"].value + } + + $PSO = [PSCustomObject]@{ + "sourceURI" = ${SourceURI} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/FileSchemaTestClass.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/FileSchemaTestClass.ps1 new file mode 100644 index 000000000000..19641687121a --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/FileSchemaTestClass.ps1 @@ -0,0 +1,110 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER File +No description available. +.PARAMETER Files +No description available. +.OUTPUTS + +FileSchemaTestClass +#> + +function Initialize-PSFileSchemaTestClass { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${File}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject[]] + ${Files} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSFileSchemaTestClass' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "file" = ${File} + "files" = ${Files} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to FileSchemaTestClass + +.DESCRIPTION + +Convert from JSON to FileSchemaTestClass + +.PARAMETER Json + +Json object + +.OUTPUTS + +FileSchemaTestClass +#> +function ConvertFrom-PSJsonToFileSchemaTestClass { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSFileSchemaTestClass' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSFileSchemaTestClass + $AllProperties = ("file", "files") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "file"))) { #optional property not found + $File = $null + } else { + $File = $JsonParameters.PSobject.Properties["file"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "files"))) { #optional property not found + $Files = $null + } else { + $Files = $JsonParameters.PSobject.Properties["files"].value + } + + $PSO = [PSCustomObject]@{ + "file" = ${File} + "files" = ${Files} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Foo.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Foo.ps1 new file mode 100644 index 000000000000..4e1adcf5e2a7 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Foo.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Bar +No description available. +.OUTPUTS + +Foo +#> + +function Initialize-PSFoo { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Bar} = "bar" + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSFoo' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "bar" = ${Bar} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Foo + +.DESCRIPTION + +Convert from JSON to Foo + +.PARAMETER Json + +Json object + +.OUTPUTS + +Foo +#> +function ConvertFrom-PSJsonToFoo { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSFoo' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSFoo + $AllProperties = ("bar") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "bar"))) { #optional property not found + $Bar = $null + } else { + $Bar = $JsonParameters.PSobject.Properties["bar"].value + } + + $PSO = [PSCustomObject]@{ + "bar" = ${Bar} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/FormatTest.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/FormatTest.ps1 new file mode 100644 index 000000000000..b0202bf07737 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/FormatTest.ps1 @@ -0,0 +1,363 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Integer +No description available. +.PARAMETER Int32 +No description available. +.PARAMETER Int64 +No description available. +.PARAMETER Number +No description available. +.PARAMETER Float +No description available. +.PARAMETER Double +No description available. +.PARAMETER Decimal +No description available. +.PARAMETER String +No description available. +.PARAMETER Byte +No description available. +.PARAMETER Binary +No description available. +.PARAMETER Date +No description available. +.PARAMETER DateTime +No description available. +.PARAMETER Uuid +No description available. +.PARAMETER Password +No description available. +.PARAMETER PatternWithDigits +A string that is a 10 digit number. Can have leading zeros. +.PARAMETER PatternWithDigitsAndDelimiter +A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. +.OUTPUTS + +FormatTest +#> + +function Initialize-PSFormatTest { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int32]] + ${Integer}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int32]] + ${Int32}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${Int64}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [Decimal] + ${Number}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Double]] + ${Float}, + [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Double]] + ${Double}, + [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Decimal]] + ${Decimal}, + [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)] + [ValidatePattern("/[a-z]/i")] + [String] + ${String}, + [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${Byte}, + [Parameter(Position = 9, ValueFromPipelineByPropertyName = $true)] + [System.IO.FileInfo] + ${Binary}, + [Parameter(Position = 10, ValueFromPipelineByPropertyName = $true)] + [System.DateTime] + ${Date}, + [Parameter(Position = 11, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[System.DateTime]] + ${DateTime}, + [Parameter(Position = 12, ValueFromPipelineByPropertyName = $true)] + [String] + ${Uuid}, + [Parameter(Position = 13, ValueFromPipelineByPropertyName = $true)] + [String] + ${Password}, + [Parameter(Position = 14, ValueFromPipelineByPropertyName = $true)] + [ValidatePattern("^\d{10}$")] + [String] + ${PatternWithDigits}, + [Parameter(Position = 15, ValueFromPipelineByPropertyName = $true)] + [ValidatePattern("/^image_\d{1,3}$/i")] + [String] + ${PatternWithDigitsAndDelimiter} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSFormatTest' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($Integer -and $Integer -gt 100) { + throw "invalid value for 'Integer', must be smaller than or equal to 100." + } + + if ($Integer -and $Integer -lt 10) { + throw "invalid value for 'Integer', must be greater than or equal to 10." + } + + if ($Int32 -and $Int32 -gt 200) { + throw "invalid value for 'Int32', must be smaller than or equal to 200." + } + + if ($Int32 -and $Int32 -lt 20) { + throw "invalid value for 'Int32', must be greater than or equal to 20." + } + + if ($null -eq $Number) { + throw "invalid value for 'Number', 'Number' cannot be null." + } + + if ($Number -gt 543.2) { + throw "invalid value for 'Number', must be smaller than or equal to 543.2." + } + + if ($Number -lt 32.1) { + throw "invalid value for 'Number', must be greater than or equal to 32.1." + } + + if ($Float -and $Float -gt 987.6) { + throw "invalid value for 'Float', must be smaller than or equal to 987.6." + } + + if ($Float -and $Float -lt 54.3) { + throw "invalid value for 'Float', must be greater than or equal to 54.3." + } + + if ($Double -and $Double -gt 123.4) { + throw "invalid value for 'Double', must be smaller than or equal to 123.4." + } + + if ($Double -and $Double -lt 67.8) { + throw "invalid value for 'Double', must be greater than or equal to 67.8." + } + + if ($null -eq $Byte) { + throw "invalid value for 'Byte', 'Byte' cannot be null." + } + + if ($null -eq $Date) { + throw "invalid value for 'Date', 'Date' cannot be null." + } + + if ($null -eq $Password) { + throw "invalid value for 'Password', 'Password' cannot be null." + } + + if ($Password.length -gt 64) { + throw "invalid value for 'Password', the character length must be smaller than or equal to 64." + } + + if ($Password.length -lt 10) { + throw "invalid value for 'Password', the character length must be great than or equal to 10." + } + + + $PSO = [PSCustomObject]@{ + "integer" = ${Integer} + "int32" = ${Int32} + "int64" = ${Int64} + "number" = ${Number} + "float" = ${Float} + "double" = ${Double} + "decimal" = ${Decimal} + "string" = ${String} + "byte" = ${Byte} + "binary" = ${Binary} + "date" = ${Date} + "dateTime" = ${DateTime} + "uuid" = ${Uuid} + "password" = ${Password} + "pattern_with_digits" = ${PatternWithDigits} + "pattern_with_digits_and_delimiter" = ${PatternWithDigitsAndDelimiter} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to FormatTest + +.DESCRIPTION + +Convert from JSON to FormatTest + +.PARAMETER Json + +Json object + +.OUTPUTS + +FormatTest +#> +function ConvertFrom-PSJsonToFormatTest { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSFormatTest' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSFormatTest + $AllProperties = ("integer", "int32", "int64", "number", "float", "double", "decimal", "string", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'number' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "number"))) { + throw "Error! JSON cannot be serialized due to the required property 'number' missing." + } else { + $Number = $JsonParameters.PSobject.Properties["number"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "byte"))) { + throw "Error! JSON cannot be serialized due to the required property 'byte' missing." + } else { + $Byte = $JsonParameters.PSobject.Properties["byte"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "date"))) { + throw "Error! JSON cannot be serialized due to the required property 'date' missing." + } else { + $Date = $JsonParameters.PSobject.Properties["date"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "password"))) { + throw "Error! JSON cannot be serialized due to the required property 'password' missing." + } else { + $Password = $JsonParameters.PSobject.Properties["password"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "integer"))) { #optional property not found + $Integer = $null + } else { + $Integer = $JsonParameters.PSobject.Properties["integer"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "int32"))) { #optional property not found + $Int32 = $null + } else { + $Int32 = $JsonParameters.PSobject.Properties["int32"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "int64"))) { #optional property not found + $Int64 = $null + } else { + $Int64 = $JsonParameters.PSobject.Properties["int64"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "float"))) { #optional property not found + $Float = $null + } else { + $Float = $JsonParameters.PSobject.Properties["float"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "double"))) { #optional property not found + $Double = $null + } else { + $Double = $JsonParameters.PSobject.Properties["double"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "decimal"))) { #optional property not found + $Decimal = $null + } else { + $Decimal = $JsonParameters.PSobject.Properties["decimal"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "string"))) { #optional property not found + $String = $null + } else { + $String = $JsonParameters.PSobject.Properties["string"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "binary"))) { #optional property not found + $Binary = $null + } else { + $Binary = $JsonParameters.PSobject.Properties["binary"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "dateTime"))) { #optional property not found + $DateTime = $null + } else { + $DateTime = $JsonParameters.PSobject.Properties["dateTime"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "uuid"))) { #optional property not found + $Uuid = $null + } else { + $Uuid = $JsonParameters.PSobject.Properties["uuid"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "pattern_with_digits"))) { #optional property not found + $PatternWithDigits = $null + } else { + $PatternWithDigits = $JsonParameters.PSobject.Properties["pattern_with_digits"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "pattern_with_digits_and_delimiter"))) { #optional property not found + $PatternWithDigitsAndDelimiter = $null + } else { + $PatternWithDigitsAndDelimiter = $JsonParameters.PSobject.Properties["pattern_with_digits_and_delimiter"].value + } + + $PSO = [PSCustomObject]@{ + "integer" = ${Integer} + "int32" = ${Int32} + "int64" = ${Int64} + "number" = ${Number} + "float" = ${Float} + "double" = ${Double} + "decimal" = ${Decimal} + "string" = ${String} + "byte" = ${Byte} + "binary" = ${Binary} + "date" = ${Date} + "dateTime" = ${DateTime} + "uuid" = ${Uuid} + "password" = ${Password} + "pattern_with_digits" = ${PatternWithDigits} + "pattern_with_digits_and_delimiter" = ${PatternWithDigitsAndDelimiter} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Fruit.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Fruit.ps1 new file mode 100644 index 000000000000..0f25aed96cc8 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Fruit.ps1 @@ -0,0 +1,82 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Json + +JSON object + +.OUTPUTS + +Fruit +#> +function ConvertFrom-PSJsonToFruit { + [CmdletBinding()] + Param ( + [AllowEmptyString()] + [string]$Json + ) + + Process { + $match = 0 + $matchType = $null + $matchInstance = $null + + # try to match Apple defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToApple $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "Apple" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'Apple' defined in oneOf (PSFruit). Proceeding to the next one if any." + } + + # try to match Banana defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToBanana $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "Banana" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'Banana' defined in oneOf (PSFruit). Proceeding to the next one if any." + } + + if ($match -gt 1) { + throw "Error! The JSON payload matches more than one type defined in oneOf schemas ([Apple, Banana]). JSON Payload: $($Json)" + } elseif ($match -eq 1) { + return [PSCustomObject]@{ + "ActualType" = ${matchType} + "ActualInstance" = ${matchInstance} + "OneOfSchemas" = @("Apple", "Banana") + } + } else { + throw "Error! The JSON payload doesn't matches any type defined in oneOf schemas ([Apple, Banana]). JSON Payload: $($Json)" + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/FruitReq.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/FruitReq.ps1 new file mode 100644 index 000000000000..40eaaaf088c4 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/FruitReq.ps1 @@ -0,0 +1,91 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Json + +JSON object + +.OUTPUTS + +FruitReq +#> +function ConvertFrom-PSJsonToFruitReq { + [CmdletBinding()] + Param ( + [AllowEmptyString()] + [string]$Json + ) + + Process { + $match = 0 + $matchType = $null + $matchInstance = $null + + # nullable check + if ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { + return [PSCustomObject]@{ + "ActualType" = $null + "ActualInstance" = $null + "OneOfSchemas" = @("AppleReq", "BananaReq") + } + } + + # try to match AppleReq defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToAppleReq $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "AppleReq" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'AppleReq' defined in oneOf (PSFruitReq). Proceeding to the next one if any." + } + + # try to match BananaReq defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToBananaReq $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "BananaReq" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'BananaReq' defined in oneOf (PSFruitReq). Proceeding to the next one if any." + } + + if ($match -gt 1) { + throw "Error! The JSON payload matches more than one type defined in oneOf schemas ([AppleReq, BananaReq]). JSON Payload: $($Json)" + } elseif ($match -eq 1) { + return [PSCustomObject]@{ + "ActualType" = ${matchType} + "ActualInstance" = ${matchInstance} + "OneOfSchemas" = @("AppleReq", "BananaReq") + } + } else { + throw "Error! The JSON payload doesn't matches any type defined in oneOf schemas ([AppleReq, BananaReq]). JSON Payload: $($Json)" + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/GmFruit.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/GmFruit.ps1 new file mode 100644 index 000000000000..ee88e644a359 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/GmFruit.ps1 @@ -0,0 +1,84 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Json + +JSON object + +.OUTPUTS + +GmFruit +#> +function ConvertFrom-PSJsonToGmFruit { + [CmdletBinding()] + Param ( + [AllowEmptyString()] + [string]$Json + ) + + Process { + $match = 0 + $matchType = $null + $matchInstance = $null + + if ($match -ne 0) { # no match yet + # try to match Apple defined in the anyOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToApple $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "Apple" + $match++ + break + } + } + } catch { + # fail to match the schema defined in anyOf, proceed to the next one + Write-Debug "Failed to match 'Apple' defined in anyOf (PSGmFruit). Proceeding to the next one if any." + } + } + + if ($match -ne 0) { # no match yet + # try to match Banana defined in the anyOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToBanana $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "Banana" + $match++ + break + } + } + } catch { + # fail to match the schema defined in anyOf, proceed to the next one + Write-Debug "Failed to match 'Banana' defined in anyOf (PSGmFruit). Proceeding to the next one if any." + } + } + + if ($match -eq 1) { + return [PSCustomObject]@{ + "ActualType" = ${matchType} + "ActualInstance" = ${matchInstance} + "anyOfSchemas" = @("Apple", "Banana") + } + } else { + throw "Error! The JSON payload doesn't matches any type defined in anyOf schemas ([Apple, Banana]). JSON Payload: $($Json)" + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/GrandparentAnimal.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/GrandparentAnimal.ps1 new file mode 100644 index 000000000000..2a73a6651f84 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/GrandparentAnimal.ps1 @@ -0,0 +1,105 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER PetType +No description available. +.OUTPUTS + +GrandparentAnimal +#> + +function Initialize-PSGrandparentAnimal { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${PetType} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSGrandparentAnimal' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $PetType) { + throw "invalid value for 'PetType', 'PetType' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "pet_type" = ${PetType} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to GrandparentAnimal + +.DESCRIPTION + +Convert from JSON to GrandparentAnimal + +.PARAMETER Json + +Json object + +.OUTPUTS + +GrandparentAnimal +#> +function ConvertFrom-PSJsonToGrandparentAnimal { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSGrandparentAnimal' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSGrandparentAnimal + $AllProperties = ("pet_type") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'pet_type' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "pet_type"))) { + throw "Error! JSON cannot be serialized due to the required property 'pet_type' missing." + } else { + $PetType = $JsonParameters.PSobject.Properties["pet_type"].value + } + + $PSO = [PSCustomObject]@{ + "pet_type" = ${PetType} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/HasOnlyReadOnly.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/HasOnlyReadOnly.ps1 new file mode 100644 index 000000000000..5a92c3469177 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/HasOnlyReadOnly.ps1 @@ -0,0 +1,110 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Bar +No description available. +.PARAMETER Foo +No description available. +.OUTPUTS + +HasOnlyReadOnly +#> + +function Initialize-PSHasOnlyReadOnly { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Bar}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${Foo} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSHasOnlyReadOnly' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "bar" = ${Bar} + "foo" = ${Foo} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to HasOnlyReadOnly + +.DESCRIPTION + +Convert from JSON to HasOnlyReadOnly + +.PARAMETER Json + +Json object + +.OUTPUTS + +HasOnlyReadOnly +#> +function ConvertFrom-PSJsonToHasOnlyReadOnly { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSHasOnlyReadOnly' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSHasOnlyReadOnly + $AllProperties = ("bar", "foo") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "bar"))) { #optional property not found + $Bar = $null + } else { + $Bar = $JsonParameters.PSobject.Properties["bar"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "foo"))) { #optional property not found + $Foo = $null + } else { + $Foo = $JsonParameters.PSobject.Properties["foo"].value + } + + $PSO = [PSCustomObject]@{ + "bar" = ${Bar} + "foo" = ${Foo} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/HealthCheckResult.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/HealthCheckResult.ps1 new file mode 100644 index 000000000000..fc87580b895c --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/HealthCheckResult.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + +.PARAMETER NullableMessage +No description available. +.OUTPUTS + +HealthCheckResult +#> + +function Initialize-PSHealthCheckResult { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${NullableMessage} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSHealthCheckResult' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "NullableMessage" = ${NullableMessage} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to HealthCheckResult + +.DESCRIPTION + +Convert from JSON to HealthCheckResult + +.PARAMETER Json + +Json object + +.OUTPUTS + +HealthCheckResult +#> +function ConvertFrom-PSJsonToHealthCheckResult { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSHealthCheckResult' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSHealthCheckResult + $AllProperties = ("NullableMessage") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "NullableMessage"))) { #optional property not found + $NullableMessage = $null + } else { + $NullableMessage = $JsonParameters.PSobject.Properties["NullableMessage"].value + } + + $PSO = [PSCustomObject]@{ + "NullableMessage" = ${NullableMessage} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/InlineResponseDefault.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/InlineResponseDefault.ps1 new file mode 100644 index 000000000000..382bb408adda --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/InlineResponseDefault.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER String +No description available. +.OUTPUTS + +InlineResponseDefault +#> + +function Initialize-PSInlineResponseDefault { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${String} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSInlineResponseDefault' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "string" = ${String} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to InlineResponseDefault + +.DESCRIPTION + +Convert from JSON to InlineResponseDefault + +.PARAMETER Json + +Json object + +.OUTPUTS + +InlineResponseDefault +#> +function ConvertFrom-PSJsonToInlineResponseDefault { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSInlineResponseDefault' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSInlineResponseDefault + $AllProperties = ("string") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "string"))) { #optional property not found + $String = $null + } else { + $String = $JsonParameters.PSobject.Properties["string"].value + } + + $PSO = [PSCustomObject]@{ + "string" = ${String} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/IsoscelesTriangle.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/IsoscelesTriangle.ps1 new file mode 100644 index 000000000000..14aeb22beb81 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/IsoscelesTriangle.ps1 @@ -0,0 +1,122 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ShapeType +No description available. +.PARAMETER TriangleType +No description available. +.OUTPUTS + +IsoscelesTriangle +#> + +function Initialize-PSIsoscelesTriangle { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${ShapeType}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${TriangleType} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSIsoscelesTriangle' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $ShapeType) { + throw "invalid value for 'ShapeType', 'ShapeType' cannot be null." + } + + if ($null -eq $TriangleType) { + throw "invalid value for 'TriangleType', 'TriangleType' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "shapeType" = ${ShapeType} + "triangleType" = ${TriangleType} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to IsoscelesTriangle + +.DESCRIPTION + +Convert from JSON to IsoscelesTriangle + +.PARAMETER Json + +Json object + +.OUTPUTS + +IsoscelesTriangle +#> +function ConvertFrom-PSJsonToIsoscelesTriangle { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSIsoscelesTriangle' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSIsoscelesTriangle + $AllProperties = ("shapeType", "triangleType") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'shapeType' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "shapeType"))) { + throw "Error! JSON cannot be serialized due to the required property 'shapeType' missing." + } else { + $ShapeType = $JsonParameters.PSobject.Properties["shapeType"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "triangleType"))) { + throw "Error! JSON cannot be serialized due to the required property 'triangleType' missing." + } else { + $TriangleType = $JsonParameters.PSobject.Properties["triangleType"].value + } + + $PSO = [PSCustomObject]@{ + "shapeType" = ${ShapeType} + "triangleType" = ${TriangleType} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/List.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/List.ps1 new file mode 100644 index 000000000000..5691aa037eaa --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/List.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Var123List +No description available. +.OUTPUTS + +List +#> + +function Initialize-PSList { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Var123List} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSList' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "123-list" = ${Var123List} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to List + +.DESCRIPTION + +Convert from JSON to List + +.PARAMETER Json + +Json object + +.OUTPUTS + +List +#> +function ConvertFrom-PSJsonToList { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSList' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSList + $AllProperties = ("123-list") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "123-list"))) { #optional property not found + $Var123List = $null + } else { + $Var123List = $JsonParameters.PSobject.Properties["123-list"].value + } + + $PSO = [PSCustomObject]@{ + "123-list" = ${Var123List} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Mammal.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Mammal.ps1 new file mode 100644 index 000000000000..21d8e373f588 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Mammal.ps1 @@ -0,0 +1,98 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Json + +JSON object + +.OUTPUTS + +Mammal +#> +function ConvertFrom-PSJsonToMammal { + [CmdletBinding()] + Param ( + [AllowEmptyString()] + [string]$Json + ) + + Process { + $match = 0 + $matchType = $null + $matchInstance = $null + + # try to match Pig defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToPig $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "Pig" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'Pig' defined in oneOf (PSMammal). Proceeding to the next one if any." + } + + # try to match Whale defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToWhale $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "Whale" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'Whale' defined in oneOf (PSMammal). Proceeding to the next one if any." + } + + # try to match Zebra defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToZebra $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "Zebra" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'Zebra' defined in oneOf (PSMammal). Proceeding to the next one if any." + } + + if ($match -gt 1) { + throw "Error! The JSON payload matches more than one type defined in oneOf schemas ([Pig, Whale, Zebra]). JSON Payload: $($Json)" + } elseif ($match -eq 1) { + return [PSCustomObject]@{ + "ActualType" = ${matchType} + "ActualInstance" = ${matchInstance} + "OneOfSchemas" = @("Pig", "Whale", "Zebra") + } + } else { + throw "Error! The JSON payload doesn't matches any type defined in oneOf schemas ([Pig, Whale, Zebra]). JSON Payload: $($Json)" + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/MapTest.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/MapTest.ps1 new file mode 100644 index 000000000000..1bbd680d68cc --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/MapTest.ps1 @@ -0,0 +1,137 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER MapMapOfString +No description available. +.PARAMETER MapOfEnumString +No description available. +.PARAMETER DirectMap +No description available. +.PARAMETER IndirectMap +No description available. +.OUTPUTS + +MapTest +#> + +function Initialize-PSMapTest { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Collections.Hashtable] + ${MapMapOfString}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [ValidateSet("UPPER", "lower")] + [System.Collections.Hashtable] + ${MapOfEnumString}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [System.Collections.Hashtable] + ${DirectMap}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [System.Collections.Hashtable] + ${IndirectMap} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSMapTest' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "map_map_of_string" = ${MapMapOfString} + "map_of_enum_string" = ${MapOfEnumString} + "direct_map" = ${DirectMap} + "indirect_map" = ${IndirectMap} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to MapTest + +.DESCRIPTION + +Convert from JSON to MapTest + +.PARAMETER Json + +Json object + +.OUTPUTS + +MapTest +#> +function ConvertFrom-PSJsonToMapTest { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSMapTest' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSMapTest + $AllProperties = ("map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "map_map_of_string"))) { #optional property not found + $MapMapOfString = $null + } else { + $MapMapOfString = $JsonParameters.PSobject.Properties["map_map_of_string"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "map_of_enum_string"))) { #optional property not found + $MapOfEnumString = $null + } else { + $MapOfEnumString = $JsonParameters.PSobject.Properties["map_of_enum_string"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "direct_map"))) { #optional property not found + $DirectMap = $null + } else { + $DirectMap = $JsonParameters.PSobject.Properties["direct_map"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "indirect_map"))) { #optional property not found + $IndirectMap = $null + } else { + $IndirectMap = $JsonParameters.PSobject.Properties["indirect_map"].value + } + + $PSO = [PSCustomObject]@{ + "map_map_of_string" = ${MapMapOfString} + "map_of_enum_string" = ${MapOfEnumString} + "direct_map" = ${DirectMap} + "indirect_map" = ${IndirectMap} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/MixedPropertiesAndAdditionalPropertiesClass.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/MixedPropertiesAndAdditionalPropertiesClass.ps1 new file mode 100644 index 000000000000..d8bd97ded588 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/MixedPropertiesAndAdditionalPropertiesClass.ps1 @@ -0,0 +1,123 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Uuid +No description available. +.PARAMETER DateTime +No description available. +.PARAMETER Map +No description available. +.OUTPUTS + +MixedPropertiesAndAdditionalPropertiesClass +#> + +function Initialize-PSMixedPropertiesAndAdditionalPropertiesClass { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Uuid}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[System.DateTime]] + ${DateTime}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [System.Collections.Hashtable] + ${Map} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSMixedPropertiesAndAdditionalPropertiesClass' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "uuid" = ${Uuid} + "dateTime" = ${DateTime} + "map" = ${Map} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to MixedPropertiesAndAdditionalPropertiesClass + +.DESCRIPTION + +Convert from JSON to MixedPropertiesAndAdditionalPropertiesClass + +.PARAMETER Json + +Json object + +.OUTPUTS + +MixedPropertiesAndAdditionalPropertiesClass +#> +function ConvertFrom-PSJsonToMixedPropertiesAndAdditionalPropertiesClass { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSMixedPropertiesAndAdditionalPropertiesClass' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSMixedPropertiesAndAdditionalPropertiesClass + $AllProperties = ("uuid", "dateTime", "map") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "uuid"))) { #optional property not found + $Uuid = $null + } else { + $Uuid = $JsonParameters.PSobject.Properties["uuid"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "dateTime"))) { #optional property not found + $DateTime = $null + } else { + $DateTime = $JsonParameters.PSobject.Properties["dateTime"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "map"))) { #optional property not found + $Map = $null + } else { + $Map = $JsonParameters.PSobject.Properties["map"].value + } + + $PSO = [PSCustomObject]@{ + "uuid" = ${Uuid} + "dateTime" = ${DateTime} + "map" = ${Map} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Model200Response.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Model200Response.ps1 new file mode 100644 index 000000000000..27a61d0fb48a --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Model200Response.ps1 @@ -0,0 +1,110 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +Model for testing model name starting with number + +.PARAMETER Name +No description available. +.PARAMETER Class +No description available. +.OUTPUTS + +Model200Response +#> + +function Initialize-PSModel200Response { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int32]] + ${Name}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${Class} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSModel200Response' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "name" = ${Name} + "class" = ${Class} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Model200Response + +.DESCRIPTION + +Convert from JSON to Model200Response + +.PARAMETER Json + +Json object + +.OUTPUTS + +Model200Response +#> +function ConvertFrom-PSJsonToModel200Response { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSModel200Response' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSModel200Response + $AllProperties = ("name", "class") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) { #optional property not found + $Name = $null + } else { + $Name = $JsonParameters.PSobject.Properties["name"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "class"))) { #optional property not found + $Class = $null + } else { + $Class = $JsonParameters.PSobject.Properties["class"].value + } + + $PSO = [PSCustomObject]@{ + "name" = ${Name} + "class" = ${Class} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/ModelReturn.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/ModelReturn.ps1 new file mode 100644 index 000000000000..1a45745f0f26 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/ModelReturn.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +Model for testing reserved words + +.PARAMETER VarReturn +No description available. +.OUTPUTS + +ModelReturn +#> + +function Initialize-PSModelReturn { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int32]] + ${VarReturn} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSModelReturn' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "return" = ${VarReturn} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to ModelReturn + +.DESCRIPTION + +Convert from JSON to ModelReturn + +.PARAMETER Json + +Json object + +.OUTPUTS + +ModelReturn +#> +function ConvertFrom-PSJsonToModelReturn { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSModelReturn' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSModelReturn + $AllProperties = ("return") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "return"))) { #optional property not found + $VarReturn = $null + } else { + $VarReturn = $JsonParameters.PSobject.Properties["return"].value + } + + $PSO = [PSCustomObject]@{ + "return" = ${VarReturn} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Name.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Name.ps1 new file mode 100644 index 000000000000..44a74e598846 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Name.ps1 @@ -0,0 +1,144 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +Model for testing model name same as property name + +.PARAMETER Name +No description available. +.PARAMETER SnakeCase +No description available. +.PARAMETER Property +No description available. +.PARAMETER Var123Number +No description available. +.OUTPUTS + +Name +#> + +function Initialize-PSName { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [Int32] + ${Name}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int32]] + ${SnakeCase}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [String] + ${Property}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int32]] + ${Var123Number} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSName' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $Name) { + throw "invalid value for 'Name', 'Name' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "name" = ${Name} + "snake_case" = ${SnakeCase} + "property" = ${Property} + "123Number" = ${Var123Number} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Name + +.DESCRIPTION + +Convert from JSON to Name + +.PARAMETER Json + +Json object + +.OUTPUTS + +Name +#> +function ConvertFrom-PSJsonToName { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSName' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSName + $AllProperties = ("name", "snake_case", "property", "123Number") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'name' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) { + throw "Error! JSON cannot be serialized due to the required property 'name' missing." + } else { + $Name = $JsonParameters.PSobject.Properties["name"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "snake_case"))) { #optional property not found + $SnakeCase = $null + } else { + $SnakeCase = $JsonParameters.PSobject.Properties["snake_case"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "property"))) { #optional property not found + $Property = $null + } else { + $Property = $JsonParameters.PSobject.Properties["property"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "123Number"))) { #optional property not found + $Var123Number = $null + } else { + $Var123Number = $JsonParameters.PSobject.Properties["123Number"].value + } + + $PSO = [PSCustomObject]@{ + "name" = ${Name} + "snake_case" = ${SnakeCase} + "property" = ${Property} + "123Number" = ${Var123Number} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/NullableClass.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/NullableClass.ps1 new file mode 100644 index 000000000000..21755910978e --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/NullableClass.ps1 @@ -0,0 +1,240 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER IntegerProp +No description available. +.PARAMETER NumberProp +No description available. +.PARAMETER BooleanProp +No description available. +.PARAMETER StringProp +No description available. +.PARAMETER DateProp +No description available. +.PARAMETER DatetimeProp +No description available. +.PARAMETER ArrayNullableProp +No description available. +.PARAMETER ArrayAndItemsNullableProp +No description available. +.PARAMETER ArrayItemsNullable +No description available. +.PARAMETER ObjectNullableProp +No description available. +.PARAMETER ObjectAndItemsNullableProp +No description available. +.PARAMETER ObjectItemsNullable +No description available. +.OUTPUTS + +NullableClass +#> + +function Initialize-PSNullableClass { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int32]] + ${IntegerProp}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Decimal]] + ${NumberProp}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Boolean]] + ${BooleanProp}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [String] + ${StringProp}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[System.DateTime]] + ${DateProp}, + [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[System.DateTime]] + ${DatetimeProp}, + [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject[]] + ${ArrayNullableProp}, + [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject[]] + ${ArrayAndItemsNullableProp}, + [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject[]] + ${ArrayItemsNullable}, + [Parameter(Position = 9, ValueFromPipelineByPropertyName = $true)] + [System.Collections.Hashtable] + ${ObjectNullableProp}, + [Parameter(Position = 10, ValueFromPipelineByPropertyName = $true)] + [System.Collections.Hashtable] + ${ObjectAndItemsNullableProp}, + [Parameter(Position = 11, ValueFromPipelineByPropertyName = $true)] + [System.Collections.Hashtable] + ${ObjectItemsNullable} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSNullableClass' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "integer_prop" = ${IntegerProp} + "number_prop" = ${NumberProp} + "boolean_prop" = ${BooleanProp} + "string_prop" = ${StringProp} + "date_prop" = ${DateProp} + "datetime_prop" = ${DatetimeProp} + "array_nullable_prop" = ${ArrayNullableProp} + "array_and_items_nullable_prop" = ${ArrayAndItemsNullableProp} + "array_items_nullable" = ${ArrayItemsNullable} + "object_nullable_prop" = ${ObjectNullableProp} + "object_and_items_nullable_prop" = ${ObjectAndItemsNullableProp} + "object_items_nullable" = ${ObjectItemsNullable} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to NullableClass + +.DESCRIPTION + +Convert from JSON to NullableClass + +.PARAMETER Json + +Json object + +.OUTPUTS + +NullableClass +#> +function ConvertFrom-PSJsonToNullableClass { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSNullableClass' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSNullableClass + $AllProperties = ("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "integer_prop"))) { #optional property not found + $IntegerProp = $null + } else { + $IntegerProp = $JsonParameters.PSobject.Properties["integer_prop"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "number_prop"))) { #optional property not found + $NumberProp = $null + } else { + $NumberProp = $JsonParameters.PSobject.Properties["number_prop"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "boolean_prop"))) { #optional property not found + $BooleanProp = $null + } else { + $BooleanProp = $JsonParameters.PSobject.Properties["boolean_prop"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "string_prop"))) { #optional property not found + $StringProp = $null + } else { + $StringProp = $JsonParameters.PSobject.Properties["string_prop"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "date_prop"))) { #optional property not found + $DateProp = $null + } else { + $DateProp = $JsonParameters.PSobject.Properties["date_prop"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "datetime_prop"))) { #optional property not found + $DatetimeProp = $null + } else { + $DatetimeProp = $JsonParameters.PSobject.Properties["datetime_prop"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_nullable_prop"))) { #optional property not found + $ArrayNullableProp = $null + } else { + $ArrayNullableProp = $JsonParameters.PSobject.Properties["array_nullable_prop"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_and_items_nullable_prop"))) { #optional property not found + $ArrayAndItemsNullableProp = $null + } else { + $ArrayAndItemsNullableProp = $JsonParameters.PSobject.Properties["array_and_items_nullable_prop"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_items_nullable"))) { #optional property not found + $ArrayItemsNullable = $null + } else { + $ArrayItemsNullable = $JsonParameters.PSobject.Properties["array_items_nullable"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "object_nullable_prop"))) { #optional property not found + $ObjectNullableProp = $null + } else { + $ObjectNullableProp = $JsonParameters.PSobject.Properties["object_nullable_prop"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "object_and_items_nullable_prop"))) { #optional property not found + $ObjectAndItemsNullableProp = $null + } else { + $ObjectAndItemsNullableProp = $JsonParameters.PSobject.Properties["object_and_items_nullable_prop"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "object_items_nullable"))) { #optional property not found + $ObjectItemsNullable = $null + } else { + $ObjectItemsNullable = $JsonParameters.PSobject.Properties["object_items_nullable"].value + } + + $PSO = [PSCustomObject]@{ + "integer_prop" = ${IntegerProp} + "number_prop" = ${NumberProp} + "boolean_prop" = ${BooleanProp} + "string_prop" = ${StringProp} + "date_prop" = ${DateProp} + "datetime_prop" = ${DatetimeProp} + "array_nullable_prop" = ${ArrayNullableProp} + "array_and_items_nullable_prop" = ${ArrayAndItemsNullableProp} + "array_items_nullable" = ${ArrayItemsNullable} + "object_nullable_prop" = ${ObjectNullableProp} + "object_and_items_nullable_prop" = ${ObjectAndItemsNullableProp} + "object_items_nullable" = ${ObjectItemsNullable} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/NullableShape.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/NullableShape.ps1 new file mode 100644 index 000000000000..c7a12cb8cf95 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/NullableShape.ps1 @@ -0,0 +1,91 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1. + +.PARAMETER Json + +JSON object + +.OUTPUTS + +NullableShape +#> +function ConvertFrom-PSJsonToNullableShape { + [CmdletBinding()] + Param ( + [AllowEmptyString()] + [string]$Json + ) + + Process { + $match = 0 + $matchType = $null + $matchInstance = $null + + # nullable check + if ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { + return [PSCustomObject]@{ + "ActualType" = $null + "ActualInstance" = $null + "OneOfSchemas" = @("Quadrilateral", "Triangle") + } + } + + # try to match Quadrilateral defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToQuadrilateral $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "Quadrilateral" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'Quadrilateral' defined in oneOf (PSNullableShape). Proceeding to the next one if any." + } + + # try to match Triangle defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToTriangle $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "Triangle" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'Triangle' defined in oneOf (PSNullableShape). Proceeding to the next one if any." + } + + if ($match -gt 1) { + throw "Error! The JSON payload matches more than one type defined in oneOf schemas ([Quadrilateral, Triangle]). JSON Payload: $($Json)" + } elseif ($match -eq 1) { + return [PSCustomObject]@{ + "ActualType" = ${matchType} + "ActualInstance" = ${matchInstance} + "OneOfSchemas" = @("Quadrilateral", "Triangle") + } + } else { + throw "Error! The JSON payload doesn't matches any type defined in oneOf schemas ([Quadrilateral, Triangle]). JSON Payload: $($Json)" + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/NumberOnly.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/NumberOnly.ps1 new file mode 100644 index 000000000000..d90506edf63c --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/NumberOnly.ps1 @@ -0,0 +1,97 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER JustNumber +No description available. +.OUTPUTS + +NumberOnly +#> + +function Initialize-PSNumberOnly { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Decimal]] + ${JustNumber} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSNumberOnly' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "JustNumber" = ${JustNumber} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to NumberOnly + +.DESCRIPTION + +Convert from JSON to NumberOnly + +.PARAMETER Json + +Json object + +.OUTPUTS + +NumberOnly +#> +function ConvertFrom-PSJsonToNumberOnly { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSNumberOnly' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSNumberOnly + $AllProperties = ("JustNumber") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "JustNumber"))) { #optional property not found + $JustNumber = $null + } else { + $JustNumber = $JsonParameters.PSobject.Properties["JustNumber"].value + } + + $PSO = [PSCustomObject]@{ + "JustNumber" = ${JustNumber} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/ObjectWithDeprecatedFields.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/ObjectWithDeprecatedFields.ps1 new file mode 100644 index 000000000000..22d222edeb0e --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/ObjectWithDeprecatedFields.ps1 @@ -0,0 +1,136 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Uuid +No description available. +.PARAMETER Id +No description available. +.PARAMETER DeprecatedRef +No description available. +.PARAMETER Bars +No description available. +.OUTPUTS + +ObjectWithDeprecatedFields +#> + +function Initialize-PSObjectWithDeprecatedFields { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Uuid}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Decimal]] + ${Id}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${DeprecatedRef}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [String[]] + ${Bars} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSObjectWithDeprecatedFields' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "uuid" = ${Uuid} + "id" = ${Id} + "deprecatedRef" = ${DeprecatedRef} + "bars" = ${Bars} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to ObjectWithDeprecatedFields + +.DESCRIPTION + +Convert from JSON to ObjectWithDeprecatedFields + +.PARAMETER Json + +Json object + +.OUTPUTS + +ObjectWithDeprecatedFields +#> +function ConvertFrom-PSJsonToObjectWithDeprecatedFields { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSObjectWithDeprecatedFields' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSObjectWithDeprecatedFields + $AllProperties = ("uuid", "id", "deprecatedRef", "bars") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "uuid"))) { #optional property not found + $Uuid = $null + } else { + $Uuid = $JsonParameters.PSobject.Properties["uuid"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) { #optional property not found + $Id = $null + } else { + $Id = $JsonParameters.PSobject.Properties["id"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "deprecatedRef"))) { #optional property not found + $DeprecatedRef = $null + } else { + $DeprecatedRef = $JsonParameters.PSobject.Properties["deprecatedRef"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "bars"))) { #optional property not found + $Bars = $null + } else { + $Bars = $JsonParameters.PSobject.Properties["bars"].value + } + + $PSO = [PSCustomObject]@{ + "uuid" = ${Uuid} + "id" = ${Id} + "deprecatedRef" = ${DeprecatedRef} + "bars" = ${Bars} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Order.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Order.ps1 index 1b931e6b197f..991563dad427 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Model/Order.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Order.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -12,7 +12,7 @@ No summary available. .DESCRIPTION -An order for a pets from the pet store +No description available. .PARAMETER Id No description available. diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/OuterComposite.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/OuterComposite.ps1 new file mode 100644 index 000000000000..7b695edfa5b3 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/OuterComposite.ps1 @@ -0,0 +1,123 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER MyNumber +No description available. +.PARAMETER MyString +No description available. +.PARAMETER MyBoolean +No description available. +.OUTPUTS + +OuterComposite +#> + +function Initialize-PSOuterComposite { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Decimal]] + ${MyNumber}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${MyString}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Boolean]] + ${MyBoolean} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSOuterComposite' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "my_number" = ${MyNumber} + "my_string" = ${MyString} + "my_boolean" = ${MyBoolean} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to OuterComposite + +.DESCRIPTION + +Convert from JSON to OuterComposite + +.PARAMETER Json + +Json object + +.OUTPUTS + +OuterComposite +#> +function ConvertFrom-PSJsonToOuterComposite { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSOuterComposite' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSOuterComposite + $AllProperties = ("my_number", "my_string", "my_boolean") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "my_number"))) { #optional property not found + $MyNumber = $null + } else { + $MyNumber = $JsonParameters.PSobject.Properties["my_number"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "my_string"))) { #optional property not found + $MyString = $null + } else { + $MyString = $JsonParameters.PSobject.Properties["my_string"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "my_boolean"))) { #optional property not found + $MyBoolean = $null + } else { + $MyBoolean = $JsonParameters.PSobject.Properties["my_boolean"].value + } + + $PSO = [PSCustomObject]@{ + "my_number" = ${MyNumber} + "my_string" = ${MyString} + "my_boolean" = ${MyBoolean} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/OuterEnum.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/OuterEnum.ps1 new file mode 100644 index 000000000000..0f7cd366d1aa --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/OuterEnum.ps1 @@ -0,0 +1,26 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +Enum OuterEnum. + +.DESCRIPTION + +No description available. +#> + +enum OuterEnum { + # enum value: "placed" + placed + # enum value: "approved" + approved + # enum value: "delivered" + delivered +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/ParentPet.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/ParentPet.ps1 new file mode 100644 index 000000000000..4b985cbec0ca --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/ParentPet.ps1 @@ -0,0 +1,105 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER PetType +No description available. +.OUTPUTS + +ParentPet +#> + +function Initialize-PSParentPet { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${PetType} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSParentPet' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $PetType) { + throw "invalid value for 'PetType', 'PetType' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "pet_type" = ${PetType} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to ParentPet + +.DESCRIPTION + +Convert from JSON to ParentPet + +.PARAMETER Json + +Json object + +.OUTPUTS + +ParentPet +#> +function ConvertFrom-PSJsonToParentPet { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSParentPet' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSParentPet + $AllProperties = ("pet_type") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'pet_type' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "pet_type"))) { + throw "Error! JSON cannot be serialized due to the required property 'pet_type' missing." + } else { + $PetType = $JsonParameters.PSobject.Properties["pet_type"].value + } + + $PSO = [PSCustomObject]@{ + "pet_type" = ${PetType} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Pet.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Pet.ps1 index 5207e6986f6e..18e5e39c684f 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Model/Pet.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Pet.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -12,7 +12,7 @@ No summary available. .DESCRIPTION -A pet for sale in the pet store +No description available. .PARAMETER Id No description available. diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/PetWithRequiredTags.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/PetWithRequiredTags.ps1 new file mode 100644 index 000000000000..af9595746385 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/PetWithRequiredTags.ps1 @@ -0,0 +1,179 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Id +No description available. +.PARAMETER Category +No description available. +.PARAMETER Name +No description available. +.PARAMETER PhotoUrls +No description available. +.PARAMETER Tags +No description available. +.PARAMETER Status +pet status in the store +.OUTPUTS + +PetWithRequiredTags +#> + +function Initialize-PSPetWithRequiredTags { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${Id}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${Category}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [String] + ${Name}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [String[]] + ${PhotoUrls}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject[]] + ${Tags}, + [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] + [ValidateSet("available", "pending", "sold")] + [String] + ${Status} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSPetWithRequiredTags' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $Name) { + throw "invalid value for 'Name', 'Name' cannot be null." + } + + if ($null -eq $PhotoUrls) { + throw "invalid value for 'PhotoUrls', 'PhotoUrls' cannot be null." + } + + if ($null -eq $Tags) { + throw "invalid value for 'Tags', 'Tags' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "id" = ${Id} + "category" = ${Category} + "name" = ${Name} + "photoUrls" = ${PhotoUrls} + "tags" = ${Tags} + "status" = ${Status} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to PetWithRequiredTags + +.DESCRIPTION + +Convert from JSON to PetWithRequiredTags + +.PARAMETER Json + +Json object + +.OUTPUTS + +PetWithRequiredTags +#> +function ConvertFrom-PSJsonToPetWithRequiredTags { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSPetWithRequiredTags' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSPetWithRequiredTags + $AllProperties = ("id", "category", "name", "photoUrls", "tags", "status") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'name' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) { + throw "Error! JSON cannot be serialized due to the required property 'name' missing." + } else { + $Name = $JsonParameters.PSobject.Properties["name"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "photoUrls"))) { + throw "Error! JSON cannot be serialized due to the required property 'photoUrls' missing." + } else { + $PhotoUrls = $JsonParameters.PSobject.Properties["photoUrls"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "tags"))) { + throw "Error! JSON cannot be serialized due to the required property 'tags' missing." + } else { + $Tags = $JsonParameters.PSobject.Properties["tags"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) { #optional property not found + $Id = $null + } else { + $Id = $JsonParameters.PSobject.Properties["id"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "category"))) { #optional property not found + $Category = $null + } else { + $Category = $JsonParameters.PSobject.Properties["category"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "status"))) { #optional property not found + $Status = $null + } else { + $Status = $JsonParameters.PSobject.Properties["status"].value + } + + $PSO = [PSCustomObject]@{ + "id" = ${Id} + "category" = ${Category} + "name" = ${Name} + "photoUrls" = ${PhotoUrls} + "tags" = ${Tags} + "status" = ${Status} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Pig.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Pig.ps1 new file mode 100644 index 000000000000..7d65ffdeb926 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Pig.ps1 @@ -0,0 +1,82 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Json + +JSON object + +.OUTPUTS + +Pig +#> +function ConvertFrom-PSJsonToPig { + [CmdletBinding()] + Param ( + [AllowEmptyString()] + [string]$Json + ) + + Process { + $match = 0 + $matchType = $null + $matchInstance = $null + + # try to match BasquePig defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToBasquePig $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "BasquePig" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'BasquePig' defined in oneOf (PSPig). Proceeding to the next one if any." + } + + # try to match DanishPig defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToDanishPig $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "DanishPig" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'DanishPig' defined in oneOf (PSPig). Proceeding to the next one if any." + } + + if ($match -gt 1) { + throw "Error! The JSON payload matches more than one type defined in oneOf schemas ([BasquePig, DanishPig]). JSON Payload: $($Json)" + } elseif ($match -eq 1) { + return [PSCustomObject]@{ + "ActualType" = ${matchType} + "ActualInstance" = ${matchInstance} + "OneOfSchemas" = @("BasquePig", "DanishPig") + } + } else { + throw "Error! The JSON payload doesn't matches any type defined in oneOf schemas ([BasquePig, DanishPig]). JSON Payload: $($Json)" + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Quadrilateral.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Quadrilateral.ps1 new file mode 100644 index 000000000000..86c8f1742553 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Quadrilateral.ps1 @@ -0,0 +1,82 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Json + +JSON object + +.OUTPUTS + +Quadrilateral +#> +function ConvertFrom-PSJsonToQuadrilateral { + [CmdletBinding()] + Param ( + [AllowEmptyString()] + [string]$Json + ) + + Process { + $match = 0 + $matchType = $null + $matchInstance = $null + + # try to match ComplexQuadrilateral defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToComplexQuadrilateral $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "ComplexQuadrilateral" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'ComplexQuadrilateral' defined in oneOf (PSQuadrilateral). Proceeding to the next one if any." + } + + # try to match SimpleQuadrilateral defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToSimpleQuadrilateral $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "SimpleQuadrilateral" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'SimpleQuadrilateral' defined in oneOf (PSQuadrilateral). Proceeding to the next one if any." + } + + if ($match -gt 1) { + throw "Error! The JSON payload matches more than one type defined in oneOf schemas ([ComplexQuadrilateral, SimpleQuadrilateral]). JSON Payload: $($Json)" + } elseif ($match -eq 1) { + return [PSCustomObject]@{ + "ActualType" = ${matchType} + "ActualInstance" = ${matchInstance} + "OneOfSchemas" = @("ComplexQuadrilateral", "SimpleQuadrilateral") + } + } else { + throw "Error! The JSON payload doesn't matches any type defined in oneOf schemas ([ComplexQuadrilateral, SimpleQuadrilateral]). JSON Payload: $($Json)" + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/QuadrilateralInterface.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/QuadrilateralInterface.ps1 new file mode 100644 index 000000000000..31903af8c6a2 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/QuadrilateralInterface.ps1 @@ -0,0 +1,105 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER QuadrilateralType +No description available. +.OUTPUTS + +QuadrilateralInterface +#> + +function Initialize-PSQuadrilateralInterface { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${QuadrilateralType} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSQuadrilateralInterface' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $QuadrilateralType) { + throw "invalid value for 'QuadrilateralType', 'QuadrilateralType' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "quadrilateralType" = ${QuadrilateralType} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to QuadrilateralInterface + +.DESCRIPTION + +Convert from JSON to QuadrilateralInterface + +.PARAMETER Json + +Json object + +.OUTPUTS + +QuadrilateralInterface +#> +function ConvertFrom-PSJsonToQuadrilateralInterface { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSQuadrilateralInterface' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSQuadrilateralInterface + $AllProperties = ("quadrilateralType") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'quadrilateralType' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "quadrilateralType"))) { + throw "Error! JSON cannot be serialized due to the required property 'quadrilateralType' missing." + } else { + $QuadrilateralType = $JsonParameters.PSobject.Properties["quadrilateralType"].value + } + + $PSO = [PSCustomObject]@{ + "quadrilateralType" = ${QuadrilateralType} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/ReadOnlyFirst.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/ReadOnlyFirst.ps1 new file mode 100644 index 000000000000..b400e18374f6 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/ReadOnlyFirst.ps1 @@ -0,0 +1,110 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Bar +No description available. +.PARAMETER Baz +No description available. +.OUTPUTS + +ReadOnlyFirst +#> + +function Initialize-PSReadOnlyFirst { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Bar}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${Baz} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSReadOnlyFirst' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "bar" = ${Bar} + "baz" = ${Baz} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to ReadOnlyFirst + +.DESCRIPTION + +Convert from JSON to ReadOnlyFirst + +.PARAMETER Json + +Json object + +.OUTPUTS + +ReadOnlyFirst +#> +function ConvertFrom-PSJsonToReadOnlyFirst { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSReadOnlyFirst' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSReadOnlyFirst + $AllProperties = ("bar", "baz") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "bar"))) { #optional property not found + $Bar = $null + } else { + $Bar = $JsonParameters.PSobject.Properties["bar"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "baz"))) { #optional property not found + $Baz = $null + } else { + $Baz = $JsonParameters.PSobject.Properties["baz"].value + } + + $PSO = [PSCustomObject]@{ + "bar" = ${Bar} + "baz" = ${Baz} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/ScaleneTriangle.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/ScaleneTriangle.ps1 new file mode 100644 index 000000000000..1bc425954b89 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/ScaleneTriangle.ps1 @@ -0,0 +1,122 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ShapeType +No description available. +.PARAMETER TriangleType +No description available. +.OUTPUTS + +ScaleneTriangle +#> + +function Initialize-PSScaleneTriangle { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${ShapeType}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${TriangleType} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSScaleneTriangle' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $ShapeType) { + throw "invalid value for 'ShapeType', 'ShapeType' cannot be null." + } + + if ($null -eq $TriangleType) { + throw "invalid value for 'TriangleType', 'TriangleType' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "shapeType" = ${ShapeType} + "triangleType" = ${TriangleType} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to ScaleneTriangle + +.DESCRIPTION + +Convert from JSON to ScaleneTriangle + +.PARAMETER Json + +Json object + +.OUTPUTS + +ScaleneTriangle +#> +function ConvertFrom-PSJsonToScaleneTriangle { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSScaleneTriangle' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSScaleneTriangle + $AllProperties = ("shapeType", "triangleType") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'shapeType' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "shapeType"))) { + throw "Error! JSON cannot be serialized due to the required property 'shapeType' missing." + } else { + $ShapeType = $JsonParameters.PSobject.Properties["shapeType"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "triangleType"))) { + throw "Error! JSON cannot be serialized due to the required property 'triangleType' missing." + } else { + $TriangleType = $JsonParameters.PSobject.Properties["triangleType"].value + } + + $PSO = [PSCustomObject]@{ + "shapeType" = ${ShapeType} + "triangleType" = ${TriangleType} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Shape.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Shape.ps1 new file mode 100644 index 000000000000..babd880c4857 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Shape.ps1 @@ -0,0 +1,82 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Json + +JSON object + +.OUTPUTS + +Shape +#> +function ConvertFrom-PSJsonToShape { + [CmdletBinding()] + Param ( + [AllowEmptyString()] + [string]$Json + ) + + Process { + $match = 0 + $matchType = $null + $matchInstance = $null + + # try to match Quadrilateral defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToQuadrilateral $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "Quadrilateral" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'Quadrilateral' defined in oneOf (PSShape). Proceeding to the next one if any." + } + + # try to match Triangle defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToTriangle $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "Triangle" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'Triangle' defined in oneOf (PSShape). Proceeding to the next one if any." + } + + if ($match -gt 1) { + throw "Error! The JSON payload matches more than one type defined in oneOf schemas ([Quadrilateral, Triangle]). JSON Payload: $($Json)" + } elseif ($match -eq 1) { + return [PSCustomObject]@{ + "ActualType" = ${matchType} + "ActualInstance" = ${matchInstance} + "OneOfSchemas" = @("Quadrilateral", "Triangle") + } + } else { + throw "Error! The JSON payload doesn't matches any type defined in oneOf schemas ([Quadrilateral, Triangle]). JSON Payload: $($Json)" + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/ShapeInterface.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/ShapeInterface.ps1 new file mode 100644 index 000000000000..58865bc4a5f5 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/ShapeInterface.ps1 @@ -0,0 +1,105 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ShapeType +No description available. +.OUTPUTS + +ShapeInterface +#> + +function Initialize-PSShapeInterface { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${ShapeType} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSShapeInterface' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $ShapeType) { + throw "invalid value for 'ShapeType', 'ShapeType' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "shapeType" = ${ShapeType} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to ShapeInterface + +.DESCRIPTION + +Convert from JSON to ShapeInterface + +.PARAMETER Json + +Json object + +.OUTPUTS + +ShapeInterface +#> +function ConvertFrom-PSJsonToShapeInterface { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSShapeInterface' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSShapeInterface + $AllProperties = ("shapeType") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'shapeType' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "shapeType"))) { + throw "Error! JSON cannot be serialized due to the required property 'shapeType' missing." + } else { + $ShapeType = $JsonParameters.PSobject.Properties["shapeType"].value + } + + $PSO = [PSCustomObject]@{ + "shapeType" = ${ShapeType} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/ShapeOrNull.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/ShapeOrNull.ps1 new file mode 100644 index 000000000000..e630c4806ec1 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/ShapeOrNull.ps1 @@ -0,0 +1,91 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + +.PARAMETER Json + +JSON object + +.OUTPUTS + +ShapeOrNull +#> +function ConvertFrom-PSJsonToShapeOrNull { + [CmdletBinding()] + Param ( + [AllowEmptyString()] + [string]$Json + ) + + Process { + $match = 0 + $matchType = $null + $matchInstance = $null + + # nullable check + if ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { + return [PSCustomObject]@{ + "ActualType" = $null + "ActualInstance" = $null + "OneOfSchemas" = @("Quadrilateral", "Triangle") + } + } + + # try to match Quadrilateral defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToQuadrilateral $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "Quadrilateral" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'Quadrilateral' defined in oneOf (PSShapeOrNull). Proceeding to the next one if any." + } + + # try to match Triangle defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToTriangle $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "Triangle" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'Triangle' defined in oneOf (PSShapeOrNull). Proceeding to the next one if any." + } + + if ($match -gt 1) { + throw "Error! The JSON payload matches more than one type defined in oneOf schemas ([Quadrilateral, Triangle]). JSON Payload: $($Json)" + } elseif ($match -eq 1) { + return [PSCustomObject]@{ + "ActualType" = ${matchType} + "ActualInstance" = ${matchInstance} + "OneOfSchemas" = @("Quadrilateral", "Triangle") + } + } else { + throw "Error! The JSON payload doesn't matches any type defined in oneOf schemas ([Quadrilateral, Triangle]). JSON Payload: $($Json)" + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/SimpleQuadrilateral.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/SimpleQuadrilateral.ps1 new file mode 100644 index 000000000000..456dbb50e0c6 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/SimpleQuadrilateral.ps1 @@ -0,0 +1,122 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER ShapeType +No description available. +.PARAMETER QuadrilateralType +No description available. +.OUTPUTS + +SimpleQuadrilateral +#> + +function Initialize-PSSimpleQuadrilateral { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${ShapeType}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${QuadrilateralType} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSSimpleQuadrilateral' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $ShapeType) { + throw "invalid value for 'ShapeType', 'ShapeType' cannot be null." + } + + if ($null -eq $QuadrilateralType) { + throw "invalid value for 'QuadrilateralType', 'QuadrilateralType' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "shapeType" = ${ShapeType} + "quadrilateralType" = ${QuadrilateralType} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to SimpleQuadrilateral + +.DESCRIPTION + +Convert from JSON to SimpleQuadrilateral + +.PARAMETER Json + +Json object + +.OUTPUTS + +SimpleQuadrilateral +#> +function ConvertFrom-PSJsonToSimpleQuadrilateral { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSSimpleQuadrilateral' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSSimpleQuadrilateral + $AllProperties = ("shapeType", "quadrilateralType") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'shapeType' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "shapeType"))) { + throw "Error! JSON cannot be serialized due to the required property 'shapeType' missing." + } else { + $ShapeType = $JsonParameters.PSobject.Properties["shapeType"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "quadrilateralType"))) { + throw "Error! JSON cannot be serialized due to the required property 'quadrilateralType' missing." + } else { + $QuadrilateralType = $JsonParameters.PSobject.Properties["quadrilateralType"].value + } + + $PSO = [PSCustomObject]@{ + "shapeType" = ${ShapeType} + "quadrilateralType" = ${QuadrilateralType} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/SpecialModelName.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/SpecialModelName.ps1 new file mode 100644 index 000000000000..53f76346d130 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/SpecialModelName.ps1 @@ -0,0 +1,110 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER SpecialPropertyName +No description available. +.PARAMETER SpecialModelName +No description available. +.OUTPUTS + +SpecialModelName +#> + +function Initialize-PSSpecialModelName { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${SpecialPropertyName}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${SpecialModelName} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSSpecialModelName' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "$special[property.name]" = ${SpecialPropertyName} + "_special_model.name_" = ${SpecialModelName} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to SpecialModelName + +.DESCRIPTION + +Convert from JSON to SpecialModelName + +.PARAMETER Json + +Json object + +.OUTPUTS + +SpecialModelName +#> +function ConvertFrom-PSJsonToSpecialModelName { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSSpecialModelName' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSSpecialModelName + $AllProperties = ("$special[property.name]", "_special_model.name_") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "$special[property.name]"))) { #optional property not found + $SpecialPropertyName = $null + } else { + $SpecialPropertyName = $JsonParameters.PSobject.Properties["$special[property.name]"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "_special_model.name_"))) { #optional property not found + $SpecialModelName = $null + } else { + $SpecialModelName = $JsonParameters.PSobject.Properties["_special_model.name_"].value + } + + $PSO = [PSCustomObject]@{ + "$special[property.name]" = ${SpecialPropertyName} + "_special_model.name_" = ${SpecialModelName} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Tag.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Tag.ps1 index 5a2d92bdb7c1..4f82edbd99b2 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Model/Tag.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Tag.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -12,7 +12,7 @@ No summary available. .DESCRIPTION -A tag for a pet +No description available. .PARAMETER Id No description available. @@ -77,14 +77,12 @@ function ConvertFrom-PSJsonToTag { $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json - $PSTagAdditionalProperties = @{} # check if Json contains properties not defined in PSTag $AllProperties = ("id", "name") foreach ($name in $JsonParameters.PsObject.Properties.Name) { - # store undefined properties in additionalProperties if (!($AllProperties.Contains($name))) { - $PSTagAdditionalProperties[$name] = $JsonParameters.PSobject.Properties[$name].value + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" } } @@ -103,7 +101,6 @@ function ConvertFrom-PSJsonToTag { $PSO = [PSCustomObject]@{ "id" = ${Id} "name" = ${Name} - "AdditionalProperties" = $PSTagAdditionalProperties } return $PSO diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Triangle.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Triangle.ps1 new file mode 100644 index 000000000000..c184b72fed9e --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Triangle.ps1 @@ -0,0 +1,98 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Json + +JSON object + +.OUTPUTS + +Triangle +#> +function ConvertFrom-PSJsonToTriangle { + [CmdletBinding()] + Param ( + [AllowEmptyString()] + [string]$Json + ) + + Process { + $match = 0 + $matchType = $null + $matchInstance = $null + + # try to match EquilateralTriangle defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToEquilateralTriangle $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "EquilateralTriangle" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'EquilateralTriangle' defined in oneOf (PSTriangle). Proceeding to the next one if any." + } + + # try to match IsoscelesTriangle defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToIsoscelesTriangle $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "IsoscelesTriangle" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'IsoscelesTriangle' defined in oneOf (PSTriangle). Proceeding to the next one if any." + } + + # try to match ScaleneTriangle defined in the oneOf schemas + try { + $matchInstance = ConvertFrom-PSJsonToScaleneTriangle $Json + + foreach($property in $matchInstance.PsObject.Properties) { + if ($null -ne $property.Value) { + $matchType = "ScaleneTriangle" + $match++ + break + } + } + } catch { + # fail to match the schema defined in oneOf, proceed to the next one + Write-Debug "Failed to match 'ScaleneTriangle' defined in oneOf (PSTriangle). Proceeding to the next one if any." + } + + if ($match -gt 1) { + throw "Error! The JSON payload matches more than one type defined in oneOf schemas ([EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle]). JSON Payload: $($Json)" + } elseif ($match -eq 1) { + return [PSCustomObject]@{ + "ActualType" = ${matchType} + "ActualInstance" = ${matchInstance} + "OneOfSchemas" = @("EquilateralTriangle", "IsoscelesTriangle", "ScaleneTriangle") + } + } else { + throw "Error! The JSON payload doesn't matches any type defined in oneOf schemas ([EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle]). JSON Payload: $($Json)" + } + } +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/TriangleInterface.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/TriangleInterface.ps1 new file mode 100644 index 000000000000..229b67a3f63a --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/TriangleInterface.ps1 @@ -0,0 +1,105 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER TriangleType +No description available. +.OUTPUTS + +TriangleInterface +#> + +function Initialize-PSTriangleInterface { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${TriangleType} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSTriangleInterface' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $TriangleType) { + throw "invalid value for 'TriangleType', 'TriangleType' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "triangleType" = ${TriangleType} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to TriangleInterface + +.DESCRIPTION + +Convert from JSON to TriangleInterface + +.PARAMETER Json + +Json object + +.OUTPUTS + +TriangleInterface +#> +function ConvertFrom-PSJsonToTriangleInterface { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSTriangleInterface' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSTriangleInterface + $AllProperties = ("triangleType") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'triangleType' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "triangleType"))) { + throw "Error! JSON cannot be serialized due to the required property 'triangleType' missing." + } else { + $TriangleType = $JsonParameters.PSobject.Properties["triangleType"].value + } + + $PSO = [PSCustomObject]@{ + "triangleType" = ${TriangleType} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/User.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/User.ps1 index a021b75ec4c9..83086452cfe8 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Model/User.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/User.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -12,7 +12,7 @@ No summary available. .DESCRIPTION -A User who is purchasing from the pet store +No description available. .PARAMETER Id No description available. @@ -30,6 +30,14 @@ No description available. No description available. .PARAMETER UserStatus User Status +.PARAMETER ObjectWithNoDeclaredProps +test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. +.PARAMETER ObjectWithNoDeclaredPropsNullable +test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. +.PARAMETER AnyTypeProp +test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 +.PARAMETER AnyTypePropNullable +test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. .OUTPUTS User @@ -54,7 +62,6 @@ function Initialize-PSUser { [String] ${Email}, [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] - [ValidatePattern("[""A-Z]+-[0-9][0-9]")] [String] ${Password}, [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)] @@ -62,7 +69,19 @@ function Initialize-PSUser { ${Phone}, [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] - ${UserStatus} + ${UserStatus}, + [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${ObjectWithNoDeclaredProps}, + [Parameter(Position = 9, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${ObjectWithNoDeclaredPropsNullable}, + [Parameter(Position = 10, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${AnyTypeProp}, + [Parameter(Position = 11, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${AnyTypePropNullable} ) Process { @@ -79,6 +98,10 @@ function Initialize-PSUser { "password" = ${Password} "phone" = ${Phone} "userStatus" = ${UserStatus} + "objectWithNoDeclaredProps" = ${ObjectWithNoDeclaredProps} + "objectWithNoDeclaredPropsNullable" = ${ObjectWithNoDeclaredPropsNullable} + "anyTypeProp" = ${AnyTypeProp} + "anyTypePropNullable" = ${AnyTypePropNullable} } @@ -116,7 +139,7 @@ function ConvertFrom-PSJsonToUser { $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in PSUser - $AllProperties = ("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus") + $AllProperties = ("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus", "objectWithNoDeclaredProps", "objectWithNoDeclaredPropsNullable", "anyTypeProp", "anyTypePropNullable") foreach ($name in $JsonParameters.PsObject.Properties.Name) { if (!($AllProperties.Contains($name))) { throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" @@ -171,6 +194,30 @@ function ConvertFrom-PSJsonToUser { $UserStatus = $JsonParameters.PSobject.Properties["userStatus"].value } + if (!([bool]($JsonParameters.PSobject.Properties.name -match "objectWithNoDeclaredProps"))) { #optional property not found + $ObjectWithNoDeclaredProps = $null + } else { + $ObjectWithNoDeclaredProps = $JsonParameters.PSobject.Properties["objectWithNoDeclaredProps"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "objectWithNoDeclaredPropsNullable"))) { #optional property not found + $ObjectWithNoDeclaredPropsNullable = $null + } else { + $ObjectWithNoDeclaredPropsNullable = $JsonParameters.PSobject.Properties["objectWithNoDeclaredPropsNullable"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "anyTypeProp"))) { #optional property not found + $AnyTypeProp = $null + } else { + $AnyTypeProp = $JsonParameters.PSobject.Properties["anyTypeProp"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "anyTypePropNullable"))) { #optional property not found + $AnyTypePropNullable = $null + } else { + $AnyTypePropNullable = $JsonParameters.PSobject.Properties["anyTypePropNullable"].value + } + $PSO = [PSCustomObject]@{ "id" = ${Id} "username" = ${Username} @@ -180,6 +227,10 @@ function ConvertFrom-PSJsonToUser { "password" = ${Password} "phone" = ${Phone} "userStatus" = ${UserStatus} + "objectWithNoDeclaredProps" = ${ObjectWithNoDeclaredProps} + "objectWithNoDeclaredPropsNullable" = ${ObjectWithNoDeclaredPropsNullable} + "anyTypeProp" = ${AnyTypeProp} + "anyTypePropNullable" = ${AnyTypePropNullable} } return $PSO diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Whale.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Whale.ps1 new file mode 100644 index 000000000000..a87cfea4e735 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Whale.ps1 @@ -0,0 +1,131 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER HasBaleen +No description available. +.PARAMETER HasTeeth +No description available. +.PARAMETER ClassName +No description available. +.OUTPUTS + +Whale +#> + +function Initialize-PSWhale { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Boolean]] + ${HasBaleen}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Boolean]] + ${HasTeeth}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [String] + ${ClassName} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSWhale' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $ClassName) { + throw "invalid value for 'ClassName', 'ClassName' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "hasBaleen" = ${HasBaleen} + "hasTeeth" = ${HasTeeth} + "className" = ${ClassName} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Whale + +.DESCRIPTION + +Convert from JSON to Whale + +.PARAMETER Json + +Json object + +.OUTPUTS + +Whale +#> +function ConvertFrom-PSJsonToWhale { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSWhale' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSWhale + $AllProperties = ("hasBaleen", "hasTeeth", "className") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'className' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "className"))) { + throw "Error! JSON cannot be serialized due to the required property 'className' missing." + } else { + $ClassName = $JsonParameters.PSobject.Properties["className"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "hasBaleen"))) { #optional property not found + $HasBaleen = $null + } else { + $HasBaleen = $JsonParameters.PSobject.Properties["hasBaleen"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "hasTeeth"))) { #optional property not found + $HasTeeth = $null + } else { + $HasTeeth = $JsonParameters.PSobject.Properties["hasTeeth"].value + } + + $PSO = [PSCustomObject]@{ + "hasBaleen" = ${HasBaleen} + "hasTeeth" = ${HasTeeth} + "className" = ${ClassName} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/Zebra.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/Zebra.ps1 new file mode 100644 index 000000000000..5bf388695db0 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/Zebra.ps1 @@ -0,0 +1,122 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Type +No description available. +.PARAMETER ClassName +No description available. +.OUTPUTS + +Zebra +#> + +function Initialize-PSZebra { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [ValidateSet("plains", "mountain", "grevys")] + [String] + ${Type}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${ClassName} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSZebra' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $ClassName) { + throw "invalid value for 'ClassName', 'ClassName' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "type" = ${Type} + "className" = ${ClassName} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Zebra + +.DESCRIPTION + +Convert from JSON to Zebra + +.PARAMETER Json + +Json object + +.OUTPUTS + +Zebra +#> +function ConvertFrom-PSJsonToZebra { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSZebra' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + $PSZebraAdditionalProperties = @{} + + # check if Json contains properties not defined in PSZebra + $AllProperties = ("type", "className") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + # store undefined properties in additionalProperties + if (!($AllProperties.Contains($name))) { + $PSZebraAdditionalProperties[$name] = $JsonParameters.PSobject.Properties[$name].value + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'className' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "className"))) { + throw "Error! JSON cannot be serialized due to the required property 'className' missing." + } else { + $ClassName = $JsonParameters.PSobject.Properties["className"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "type"))) { #optional property not found + $Type = $null + } else { + $Type = $JsonParameters.PSobject.Properties["type"].value + } + + $PSO = [PSCustomObject]@{ + "type" = ${Type} + "className" = ${ClassName} + "AdditionalProperties" = $PSZebraAdditionalProperties + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1 b/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1 index 2860418807da..1127e0c738d0 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1 +++ b/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1 @@ -3,7 +3,7 @@ # # Generated by: OpenAPI Generator Team # -# Generated on: 10/30/2021 +# Generated on: 04/08/2022 # @{ @@ -69,21 +69,107 @@ PowerShellVersion = '5.0' # NestedModules = @() # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. -FunctionsToExport = 'Add-PSPet', 'Remove-Pet', 'Find-PSPetsByStatus', 'Find-PSPetsByTags', +FunctionsToExport = 'Invoke-PS123TestSpecialTags', 'Invoke-PSFooGet', + 'Invoke-PSFakeHealthGet', 'Invoke-PSFakeOuterBooleanSerialize', + 'Invoke-PSFakeOuterCompositeSerialize', + 'Invoke-PSFakeOuterNumberSerialize', + 'Invoke-PSFakeOuterStringSerialize', 'Get-PSArrayOfEnums', + 'Test-PSBodyWithFileSchema', 'Test-PSBodyWithQueryParams', + 'Test-PSClientModel', 'Test-PSEndpointParameters', + 'Test-PSEnumParameters', 'Test-PSGroupParameters', + 'Test-PSInlineAdditionalProperties', 'Test-PSJsonFormData', + 'Test-PSQueryParameterCollectionFormat', 'Test-PSClassname', + 'Add-PSPet', 'Remove-Pet', 'Find-PSPetsByStatus', 'Find-PSPetsByTags', 'Get-PSPetById', 'Update-PSPet', 'Update-PSPetWithForm', - 'Invoke-PSUploadFile', 'Remove-PSOrder', 'Get-PSInventory', - 'Get-PSOrderById', 'Invoke-PSPlaceOrder', 'New-PSUser', - 'New-PSUsersWithArrayInput', 'New-PSUsersWithListInput', - 'Remove-PSUser', 'Get-PSUserByName', 'Invoke-PSLoginUser', - 'Invoke-PSLogoutUser', 'Update-PSUser', 'Initialize-PSApiResponse', - 'ConvertFrom-PSJsonToApiResponse', 'Initialize-PSCategory', - 'ConvertFrom-PSJsonToCategory', 'Initialize-PSInlineObject', - 'ConvertFrom-PSJsonToInlineObject', 'Initialize-PSInlineObject1', - 'ConvertFrom-PSJsonToInlineObject1', 'Initialize-PSOrder', - 'ConvertFrom-PSJsonToOrder', 'Initialize-PSPet', - 'ConvertFrom-PSJsonToPet', 'Initialize-PSTag', - 'ConvertFrom-PSJsonToTag', 'Initialize-PSUser', - 'ConvertFrom-PSJsonToUser', 'Get-PSConfiguration', + 'Invoke-PSUploadFile', 'Invoke-PSUploadFileWithRequiredFile', + 'Remove-PSOrder', 'Get-PSInventory', 'Get-PSOrderById', + 'Invoke-PSPlaceOrder', 'New-PSUser', 'New-PSUsersWithArrayInput', + 'New-PSUsersWithListInput', 'Remove-PSUser', 'Get-PSUserByName', + 'Invoke-PSLoginUser', 'Invoke-PSLogoutUser', 'Update-PSUser', + 'Initialize-PSAdditionalPropertiesClass', + 'ConvertFrom-PSJsonToAdditionalPropertiesClass', + 'Initialize-PSAnimal', 'ConvertFrom-PSJsonToAnimal', + 'Initialize-PSApiResponse', 'ConvertFrom-PSJsonToApiResponse', + 'Initialize-PSApple', 'ConvertFrom-PSJsonToApple', + 'Initialize-PSAppleReq', 'ConvertFrom-PSJsonToAppleReq', + 'Initialize-PSArrayOfArrayOfNumberOnly', + 'ConvertFrom-PSJsonToArrayOfArrayOfNumberOnly', + 'Initialize-PSArrayOfNumberOnly', + 'ConvertFrom-PSJsonToArrayOfNumberOnly', 'Initialize-PSArrayTest', + 'ConvertFrom-PSJsonToArrayTest', 'Initialize-PSBanana', + 'ConvertFrom-PSJsonToBanana', 'Initialize-PSBananaReq', + 'ConvertFrom-PSJsonToBananaReq', 'Initialize-PSBasquePig', + 'ConvertFrom-PSJsonToBasquePig', 'Initialize-PSCapitalization', + 'ConvertFrom-PSJsonToCapitalization', 'Initialize-PSCat', + 'ConvertFrom-PSJsonToCat', 'Initialize-PSCatAllOf', + 'ConvertFrom-PSJsonToCatAllOf', 'Initialize-PSCategory', + 'ConvertFrom-PSJsonToCategory', 'Initialize-PSClassModel', + 'ConvertFrom-PSJsonToClassModel', 'Initialize-PSClient', + 'ConvertFrom-PSJsonToClient', 'Initialize-PSComplexQuadrilateral', + 'ConvertFrom-PSJsonToComplexQuadrilateral', + 'Initialize-PSDanishPig', 'ConvertFrom-PSJsonToDanishPig', + 'Initialize-PSDeprecatedObject', + 'ConvertFrom-PSJsonToDeprecatedObject', 'Initialize-PSDog', + 'ConvertFrom-PSJsonToDog', 'Initialize-PSDogAllOf', + 'ConvertFrom-PSJsonToDogAllOf', 'Initialize-PSDrawing', + 'ConvertFrom-PSJsonToDrawing', 'Initialize-PSEnumArrays', + 'ConvertFrom-PSJsonToEnumArrays', 'Initialize-PSEnumTest', + 'ConvertFrom-PSJsonToEnumTest', 'Initialize-PSEquilateralTriangle', + 'ConvertFrom-PSJsonToEquilateralTriangle', 'Initialize-PSFile', + 'ConvertFrom-PSJsonToFile', 'Initialize-PSFileSchemaTestClass', + 'ConvertFrom-PSJsonToFileSchemaTestClass', 'Initialize-PSFoo', + 'ConvertFrom-PSJsonToFoo', 'Initialize-PSFormatTest', + 'ConvertFrom-PSJsonToFormatTest', 'ConvertFrom-PSJsonToFruit', + 'ConvertFrom-PSJsonToFruitReq', 'ConvertFrom-PSJsonToGmFruit', + 'Initialize-PSGrandparentAnimal', + 'ConvertFrom-PSJsonToGrandparentAnimal', + 'Initialize-PSHasOnlyReadOnly', + 'ConvertFrom-PSJsonToHasOnlyReadOnly', + 'Initialize-PSHealthCheckResult', + 'ConvertFrom-PSJsonToHealthCheckResult', + 'Initialize-PSInlineObject', 'ConvertFrom-PSJsonToInlineObject', + 'Initialize-PSInlineObject1', 'ConvertFrom-PSJsonToInlineObject1', + 'Initialize-PSInlineResponseDefault', + 'ConvertFrom-PSJsonToInlineResponseDefault', + 'Initialize-PSIsoscelesTriangle', + 'ConvertFrom-PSJsonToIsoscelesTriangle', 'Initialize-PSList', + 'ConvertFrom-PSJsonToList', 'ConvertFrom-PSJsonToMammal', + 'Initialize-PSMapTest', 'ConvertFrom-PSJsonToMapTest', + 'Initialize-PSMixedPropertiesAndAdditionalPropertiesClass', + 'ConvertFrom-PSJsonToMixedPropertiesAndAdditionalPropertiesClass', + 'Initialize-PSModel200Response', + 'ConvertFrom-PSJsonToModel200Response', 'Initialize-PSModelReturn', + 'ConvertFrom-PSJsonToModelReturn', 'Initialize-PSName', + 'ConvertFrom-PSJsonToName', 'Initialize-PSNullableClass', + 'ConvertFrom-PSJsonToNullableClass', + 'ConvertFrom-PSJsonToNullableShape', 'Initialize-PSNumberOnly', + 'ConvertFrom-PSJsonToNumberOnly', + 'Initialize-PSObjectWithDeprecatedFields', + 'ConvertFrom-PSJsonToObjectWithDeprecatedFields', + 'Initialize-PSOrder', 'ConvertFrom-PSJsonToOrder', + 'Initialize-PSOuterComposite', 'ConvertFrom-PSJsonToOuterComposite', + 'Initialize-PSParentPet', 'ConvertFrom-PSJsonToParentPet', + 'Initialize-PSPet', 'ConvertFrom-PSJsonToPet', + 'Initialize-PSPetWithRequiredTags', + 'ConvertFrom-PSJsonToPetWithRequiredTags', + 'ConvertFrom-PSJsonToPig', 'ConvertFrom-PSJsonToQuadrilateral', + 'Initialize-PSQuadrilateralInterface', + 'ConvertFrom-PSJsonToQuadrilateralInterface', + 'Initialize-PSReadOnlyFirst', 'ConvertFrom-PSJsonToReadOnlyFirst', + 'Initialize-PSScaleneTriangle', + 'ConvertFrom-PSJsonToScaleneTriangle', 'ConvertFrom-PSJsonToShape', + 'Initialize-PSShapeInterface', 'ConvertFrom-PSJsonToShapeInterface', + 'ConvertFrom-PSJsonToShapeOrNull', + 'Initialize-PSSimpleQuadrilateral', + 'ConvertFrom-PSJsonToSimpleQuadrilateral', + 'Initialize-PSSpecialModelName', + 'ConvertFrom-PSJsonToSpecialModelName', 'Initialize-PSTag', + 'ConvertFrom-PSJsonToTag', 'ConvertFrom-PSJsonToTriangle', + 'Initialize-PSTriangleInterface', + 'ConvertFrom-PSJsonToTriangleInterface', 'Initialize-PSUser', + 'ConvertFrom-PSJsonToUser', 'Initialize-PSWhale', + 'ConvertFrom-PSJsonToWhale', 'Initialize-PSZebra', + 'ConvertFrom-PSJsonToZebra', 'Get-PSConfiguration', 'Set-PSConfiguration', 'Set-PSConfigurationApiKey', 'Set-PSConfigurationApiKeyPrefix', 'Set-PSConfigurationDefaultHeader', 'Get-PSHostSetting', diff --git a/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psm1 b/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psm1 index bc8d8503afe3..8b0bd5f780e4 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psm1 +++ b/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psm1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # diff --git a/samples/client/petstore/powershell/src/PSPetstore/Private/Get-CommonParameters.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Private/Get-CommonParameters.ps1 index 4073dbe44cc2..c24066ab1c66 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Private/Get-CommonParameters.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Private/Get-CommonParameters.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # diff --git a/samples/client/petstore/powershell/src/PSPetstore/Private/Out-DebugParameter.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Private/Out-DebugParameter.ps1 index 3307691956aa..0ca752e7bada 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Private/Out-DebugParameter.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Private/Out-DebugParameter.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # diff --git a/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 index be338cd33eb4..ce637871f545 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -130,6 +130,23 @@ function Invoke-PSApiClient { } } + # http signature authentication + $httpSigningConfig = Get-PSConfigurationHttpSigning + if ($null -ne $httpSigningConfig) { + $httpSignHeaderArgument = @{ + Method = $Method + UriBuilder = $UriBuilder + Body = $Body + RequestHeader = $HeaderParameters + } + $signedHeader = Get-PSHttpSignedHeader @httpSignHeaderArgument + if($null -ne $signedHeader -and $signedHeader.Count -gt 0){ + foreach($item in $signedHeader.GetEnumerator()){ + $HeaderParameters[$item.Name] = $item.Value + } + } + } + if ($SkipCertificateCheck -eq $true) { if ($null -eq $Configuration["Proxy"]) { # skip certification check, no proxy diff --git a/samples/client/petstore/powershell/src/PSPetstore/Private/PSHttpSignatureAuth.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Private/PSHttpSignatureAuth.ps1 index 21bfb717d7b2..1b2b77175905 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Private/PSHttpSignatureAuth.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Private/PSHttpSignatureAuth.ps1 @@ -1,6 +1,6 @@ # # 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. +# 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 # Generated by OpenAPI Generator: https://openapi-generator.tech # diff --git a/samples/client/petstore/powershell/src/PSPetstore/Private/PSRSAEncryptionProvider.cs b/samples/client/petstore/powershell/src/PSPetstore/Private/PSRSAEncryptionProvider.cs index 27f40d771724..ea6d93efa7fc 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Private/PSRSAEncryptionProvider.cs +++ b/samples/client/petstore/powershell/src/PSPetstore/Private/PSRSAEncryptionProvider.cs @@ -1,7 +1,7 @@ /* * 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. + * 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 * Generated by: https://github.com/openapitools/openapi-generator.git diff --git a/samples/client/petstore/powershell/src/PSPetstore/en-US/about_PSPetstore.help.txt b/samples/client/petstore/powershell/src/PSPetstore/en-US/about_PSPetstore.help.txt index af56b5a29483..4f26f83ad410 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/en-US/about_PSPetstore.help.txt +++ b/samples/client/petstore/powershell/src/PSPetstore/en-US/about_PSPetstore.help.txt @@ -5,7 +5,7 @@ SHORT DESCRIPTION PSPetstore - the PowerShell module for the OpenAPI Petstore LONG DESCRIPTION - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: "" \ This PowerShell module is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: diff --git a/samples/client/petstore/powershell/tests/Api/PSAnotherFakeApi.Tests.ps1 b/samples/client/petstore/powershell/tests/Api/PSAnotherFakeApi.Tests.ps1 new file mode 100644 index 000000000000..34a93ab62c00 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Api/PSAnotherFakeApi.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSPSAnotherFakeApi' { + Context 'Invoke-PS123TestSpecialTags' { + It 'Test Invoke-PS123TestSpecialTags' { + #$TestResult = Invoke-PS123TestSpecialTags -Client "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + +} diff --git a/samples/client/petstore/powershell/tests/Api/PSDefaultApi.Tests.ps1 b/samples/client/petstore/powershell/tests/Api/PSDefaultApi.Tests.ps1 new file mode 100644 index 000000000000..5df5a0ee821b --- /dev/null +++ b/samples/client/petstore/powershell/tests/Api/PSDefaultApi.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSPSDefaultApi' { + Context 'Invoke-PSFooGet' { + It 'Test Invoke-PSFooGet' { + #$TestResult = Invoke-PSFooGet + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + +} diff --git a/samples/client/petstore/powershell/tests/Api/PSFakeApi.Tests.ps1 b/samples/client/petstore/powershell/tests/Api/PSFakeApi.Tests.ps1 new file mode 100644 index 000000000000..1900eab70f81 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Api/PSFakeApi.Tests.ps1 @@ -0,0 +1,129 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSPSFakeApi' { + Context 'Invoke-PSFakeHealthGet' { + It 'Test Invoke-PSFakeHealthGet' { + #$TestResult = Invoke-PSFakeHealthGet + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Invoke-PSFakeOuterBooleanSerialize' { + It 'Test Invoke-PSFakeOuterBooleanSerialize' { + #$TestResult = Invoke-PSFakeOuterBooleanSerialize -Body "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Invoke-PSFakeOuterCompositeSerialize' { + It 'Test Invoke-PSFakeOuterCompositeSerialize' { + #$TestResult = Invoke-PSFakeOuterCompositeSerialize -OuterComposite "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Invoke-PSFakeOuterNumberSerialize' { + It 'Test Invoke-PSFakeOuterNumberSerialize' { + #$TestResult = Invoke-PSFakeOuterNumberSerialize -Body "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Invoke-PSFakeOuterStringSerialize' { + It 'Test Invoke-PSFakeOuterStringSerialize' { + #$TestResult = Invoke-PSFakeOuterStringSerialize -Body "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Get-PSArrayOfEnums' { + It 'Test Get-PSArrayOfEnums' { + #$TestResult = Get-PSArrayOfEnums + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-PSBodyWithFileSchema' { + It 'Test Test-PSBodyWithFileSchema' { + #$TestResult = Test-PSBodyWithFileSchema -FileSchemaTestClass "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-PSBodyWithQueryParams' { + It 'Test Test-PSBodyWithQueryParams' { + #$TestResult = Test-PSBodyWithQueryParams -Query "TEST_VALUE" -User "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-PSClientModel' { + It 'Test Test-PSClientModel' { + #$TestResult = Test-PSClientModel -Client "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-PSEndpointParameters' { + It 'Test Test-PSEndpointParameters' { + #$TestResult = Test-PSEndpointParameters -Number "TEST_VALUE" -Double "TEST_VALUE" -PatternWithoutDelimiter "TEST_VALUE" -Byte "TEST_VALUE" -Integer "TEST_VALUE" -Int32 "TEST_VALUE" -Int64 "TEST_VALUE" -Float "TEST_VALUE" -String "TEST_VALUE" -Binary "TEST_VALUE" -Date "TEST_VALUE" -DateTime "TEST_VALUE" -Password "TEST_VALUE" -Callback "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-PSEnumParameters' { + It 'Test Test-PSEnumParameters' { + #$TestResult = Test-PSEnumParameters -EnumHeaderStringArray "TEST_VALUE" -EnumHeaderString "TEST_VALUE" -EnumQueryStringArray "TEST_VALUE" -EnumQueryString "TEST_VALUE" -EnumQueryInteger "TEST_VALUE" -EnumQueryDouble "TEST_VALUE" -EnumFormStringArray "TEST_VALUE" -EnumFormString "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-PSGroupParameters' { + It 'Test Test-PSGroupParameters' { + #$TestResult = Test-PSGroupParameters -RequiredStringGroup "TEST_VALUE" -RequiredBooleanGroup "TEST_VALUE" -RequiredInt64Group "TEST_VALUE" -StringGroup "TEST_VALUE" -BooleanGroup "TEST_VALUE" -Int64Group "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-PSInlineAdditionalProperties' { + It 'Test Test-PSInlineAdditionalProperties' { + #$TestResult = Test-PSInlineAdditionalProperties -RequestBody "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-PSJsonFormData' { + It 'Test Test-PSJsonFormData' { + #$TestResult = Test-PSJsonFormData -Param "TEST_VALUE" -Param2 "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-PSQueryParameterCollectionFormat' { + It 'Test Test-PSQueryParameterCollectionFormat' { + #$TestResult = Test-PSQueryParameterCollectionFormat -Pipe "TEST_VALUE" -Ioutil "TEST_VALUE" -Http "TEST_VALUE" -Url "TEST_VALUE" -Context "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + +} diff --git a/samples/client/petstore/powershell/tests/Api/PSFakeClassnameTags123Api.Tests.ps1 b/samples/client/petstore/powershell/tests/Api/PSFakeClassnameTags123Api.Tests.ps1 new file mode 100644 index 000000000000..d652f093e6bd --- /dev/null +++ b/samples/client/petstore/powershell/tests/Api/PSFakeClassnameTags123Api.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSPSFakeClassnameTags123Api' { + Context 'Test-PSClassname' { + It 'Test Test-PSClassname' { + #$TestResult = Test-PSClassname -Client "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + +} diff --git a/samples/client/petstore/powershell/tests/Model/AdditionalPropertiesClass.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/AdditionalPropertiesClass.Tests.ps1 new file mode 100644 index 000000000000..5591ad86df46 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/AdditionalPropertiesClass.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSAdditionalPropertiesClass' { + Context 'PSAdditionalPropertiesClass' { + It 'Initialize-PSAdditionalPropertiesClass' { + # a simple test to create an object + #$NewObject = Initialize-PSAdditionalPropertiesClass -MapProperty "TEST_VALUE" -MapOfMapProperty "TEST_VALUE" -Anytype1 "TEST_VALUE" -MapWithUndeclaredPropertiesAnytype1 "TEST_VALUE" -MapWithUndeclaredPropertiesAnytype2 "TEST_VALUE" -MapWithUndeclaredPropertiesAnytype3 "TEST_VALUE" -EmptyMap "TEST_VALUE" -MapWithUndeclaredPropertiesString "TEST_VALUE" + #$NewObject | Should -BeOfType AdditionalPropertiesClass + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Animal.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Animal.Tests.ps1 new file mode 100644 index 000000000000..ed3c725f722c --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Animal.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSAnimal' { + Context 'PSAnimal' { + It 'Initialize-PSAnimal' { + # a simple test to create an object + #$NewObject = Initialize-PSAnimal -ClassName "TEST_VALUE" -Color "TEST_VALUE" + #$NewObject | Should -BeOfType Animal + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Apple.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Apple.Tests.ps1 new file mode 100644 index 000000000000..ac286c7360fc --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Apple.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSApple' { + Context 'PSApple' { + It 'Initialize-PSApple' { + # a simple test to create an object + #$NewObject = Initialize-PSApple -Cultivar "TEST_VALUE" -Origin "TEST_VALUE" + #$NewObject | Should -BeOfType Apple + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/AppleReq.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/AppleReq.Tests.ps1 new file mode 100644 index 000000000000..f83d73f7df16 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/AppleReq.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSAppleReq' { + Context 'PSAppleReq' { + It 'Initialize-PSAppleReq' { + # a simple test to create an object + #$NewObject = Initialize-PSAppleReq -Cultivar "TEST_VALUE" -Mealy "TEST_VALUE" + #$NewObject | Should -BeOfType AppleReq + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/ArrayOfArrayOfNumberOnly.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/ArrayOfArrayOfNumberOnly.Tests.ps1 new file mode 100644 index 000000000000..ac7145839fdf --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/ArrayOfArrayOfNumberOnly.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSArrayOfArrayOfNumberOnly' { + Context 'PSArrayOfArrayOfNumberOnly' { + It 'Initialize-PSArrayOfArrayOfNumberOnly' { + # a simple test to create an object + #$NewObject = Initialize-PSArrayOfArrayOfNumberOnly -ArrayArrayNumber "TEST_VALUE" + #$NewObject | Should -BeOfType ArrayOfArrayOfNumberOnly + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/ArrayOfNumberOnly.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/ArrayOfNumberOnly.Tests.ps1 new file mode 100644 index 000000000000..17d0a3e5b912 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/ArrayOfNumberOnly.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSArrayOfNumberOnly' { + Context 'PSArrayOfNumberOnly' { + It 'Initialize-PSArrayOfNumberOnly' { + # a simple test to create an object + #$NewObject = Initialize-PSArrayOfNumberOnly -ArrayNumber "TEST_VALUE" + #$NewObject | Should -BeOfType ArrayOfNumberOnly + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/ArrayTest.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/ArrayTest.Tests.ps1 new file mode 100644 index 000000000000..9d83436a8055 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/ArrayTest.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSArrayTest' { + Context 'PSArrayTest' { + It 'Initialize-PSArrayTest' { + # a simple test to create an object + #$NewObject = Initialize-PSArrayTest -ArrayOfString "TEST_VALUE" -ArrayArrayOfInteger "TEST_VALUE" -ArrayArrayOfModel "TEST_VALUE" + #$NewObject | Should -BeOfType ArrayTest + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Banana.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Banana.Tests.ps1 new file mode 100644 index 000000000000..dc3757c24e5a --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Banana.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSBanana' { + Context 'PSBanana' { + It 'Initialize-PSBanana' { + # a simple test to create an object + #$NewObject = Initialize-PSBanana -LengthCm "TEST_VALUE" + #$NewObject | Should -BeOfType Banana + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/BananaReq.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/BananaReq.Tests.ps1 new file mode 100644 index 000000000000..705e2952cead --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/BananaReq.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSBananaReq' { + Context 'PSBananaReq' { + It 'Initialize-PSBananaReq' { + # a simple test to create an object + #$NewObject = Initialize-PSBananaReq -LengthCm "TEST_VALUE" -Sweet "TEST_VALUE" + #$NewObject | Should -BeOfType BananaReq + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/BasquePig.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/BasquePig.Tests.ps1 new file mode 100644 index 000000000000..4ac6e20256ed --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/BasquePig.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSBasquePig' { + Context 'PSBasquePig' { + It 'Initialize-PSBasquePig' { + # a simple test to create an object + #$NewObject = Initialize-PSBasquePig -ClassName "TEST_VALUE" + #$NewObject | Should -BeOfType BasquePig + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Capitalization.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Capitalization.Tests.ps1 new file mode 100644 index 000000000000..83bf5c288fd8 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Capitalization.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSCapitalization' { + Context 'PSCapitalization' { + It 'Initialize-PSCapitalization' { + # a simple test to create an object + #$NewObject = Initialize-PSCapitalization -SmallCamel "TEST_VALUE" -CapitalCamel "TEST_VALUE" -SmallSnake "TEST_VALUE" -CapitalSnake "TEST_VALUE" -SCAETHFlowPoints "TEST_VALUE" -ATTNAME "TEST_VALUE" + #$NewObject | Should -BeOfType Capitalization + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Cat.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Cat.Tests.ps1 new file mode 100644 index 000000000000..d31b9a8dde9e --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Cat.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSCat' { + Context 'PSCat' { + It 'Initialize-PSCat' { + # a simple test to create an object + #$NewObject = Initialize-PSCat -ClassName "TEST_VALUE" -Color "TEST_VALUE" -Declawed "TEST_VALUE" + #$NewObject | Should -BeOfType Cat + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/CatAllOf.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/CatAllOf.Tests.ps1 new file mode 100644 index 000000000000..49a7a4862c5c --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/CatAllOf.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSCatAllOf' { + Context 'PSCatAllOf' { + It 'Initialize-PSCatAllOf' { + # a simple test to create an object + #$NewObject = Initialize-PSCatAllOf -Declawed "TEST_VALUE" + #$NewObject | Should -BeOfType CatAllOf + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/ClassModel.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/ClassModel.Tests.ps1 new file mode 100644 index 000000000000..01b89314fc34 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/ClassModel.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSClassModel' { + Context 'PSClassModel' { + It 'Initialize-PSClassModel' { + # a simple test to create an object + #$NewObject = Initialize-PSClassModel -Class "TEST_VALUE" + #$NewObject | Should -BeOfType ClassModel + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Client.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Client.Tests.ps1 new file mode 100644 index 000000000000..caf3bd8ffd93 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Client.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSClient' { + Context 'PSClient' { + It 'Initialize-PSClient' { + # a simple test to create an object + #$NewObject = Initialize-PSClient -Client "TEST_VALUE" + #$NewObject | Should -BeOfType Client + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/ComplexQuadrilateral.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/ComplexQuadrilateral.Tests.ps1 new file mode 100644 index 000000000000..106b06dc9b2c --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/ComplexQuadrilateral.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSComplexQuadrilateral' { + Context 'PSComplexQuadrilateral' { + It 'Initialize-PSComplexQuadrilateral' { + # a simple test to create an object + #$NewObject = Initialize-PSComplexQuadrilateral -ShapeType "TEST_VALUE" -QuadrilateralType "TEST_VALUE" + #$NewObject | Should -BeOfType ComplexQuadrilateral + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/DanishPig.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/DanishPig.Tests.ps1 new file mode 100644 index 000000000000..0396b0004fe2 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/DanishPig.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSDanishPig' { + Context 'PSDanishPig' { + It 'Initialize-PSDanishPig' { + # a simple test to create an object + #$NewObject = Initialize-PSDanishPig -ClassName "TEST_VALUE" + #$NewObject | Should -BeOfType DanishPig + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/DeprecatedObject.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/DeprecatedObject.Tests.ps1 new file mode 100644 index 000000000000..715b169a6179 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/DeprecatedObject.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSDeprecatedObject' { + Context 'PSDeprecatedObject' { + It 'Initialize-PSDeprecatedObject' { + # a simple test to create an object + #$NewObject = Initialize-PSDeprecatedObject -Name "TEST_VALUE" + #$NewObject | Should -BeOfType DeprecatedObject + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Dog.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Dog.Tests.ps1 new file mode 100644 index 000000000000..aa9921cc096a --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Dog.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSDog' { + Context 'PSDog' { + It 'Initialize-PSDog' { + # a simple test to create an object + #$NewObject = Initialize-PSDog -ClassName "TEST_VALUE" -Color "TEST_VALUE" -Breed "TEST_VALUE" + #$NewObject | Should -BeOfType Dog + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/DogAllOf.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/DogAllOf.Tests.ps1 new file mode 100644 index 000000000000..574addf84d2c --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/DogAllOf.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSDogAllOf' { + Context 'PSDogAllOf' { + It 'Initialize-PSDogAllOf' { + # a simple test to create an object + #$NewObject = Initialize-PSDogAllOf -Breed "TEST_VALUE" + #$NewObject | Should -BeOfType DogAllOf + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Drawing.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Drawing.Tests.ps1 new file mode 100644 index 000000000000..183189b03211 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Drawing.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSDrawing' { + Context 'PSDrawing' { + It 'Initialize-PSDrawing' { + # a simple test to create an object + #$NewObject = Initialize-PSDrawing -MainShape "TEST_VALUE" -ShapeOrNull "TEST_VALUE" -NullableShape "TEST_VALUE" -Shapes "TEST_VALUE" + #$NewObject | Should -BeOfType Drawing + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/EnumArrays.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/EnumArrays.Tests.ps1 new file mode 100644 index 000000000000..2ce925ff56de --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/EnumArrays.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSEnumArrays' { + Context 'PSEnumArrays' { + It 'Initialize-PSEnumArrays' { + # a simple test to create an object + #$NewObject = Initialize-PSEnumArrays -JustSymbol "TEST_VALUE" -ArrayEnum "TEST_VALUE" + #$NewObject | Should -BeOfType EnumArrays + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/EnumClass.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/EnumClass.Tests.ps1 new file mode 100644 index 000000000000..9ed480f49421 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/EnumClass.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSEnumClass' { + Context 'PSEnumClass' { + It 'Initialize-PSEnumClass' { + # a simple test to create an object + #$NewObject = Initialize-PSEnumClass + #$NewObject | Should -BeOfType EnumClass + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/EnumTest.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/EnumTest.Tests.ps1 new file mode 100644 index 000000000000..e7f1a863029b --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/EnumTest.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSEnumTest' { + Context 'PSEnumTest' { + It 'Initialize-PSEnumTest' { + # a simple test to create an object + #$NewObject = Initialize-PSEnumTest -EnumString "TEST_VALUE" -EnumStringRequired "TEST_VALUE" -EnumInteger "TEST_VALUE" -EnumIntegerOnly "TEST_VALUE" -EnumNumber "TEST_VALUE" -OuterEnum "TEST_VALUE" -OuterEnumInteger "TEST_VALUE" -OuterEnumDefaultValue "TEST_VALUE" -OuterEnumIntegerDefaultValue "TEST_VALUE" + #$NewObject | Should -BeOfType EnumTest + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/EquilateralTriangle.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/EquilateralTriangle.Tests.ps1 new file mode 100644 index 000000000000..472983e6d354 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/EquilateralTriangle.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSEquilateralTriangle' { + Context 'PSEquilateralTriangle' { + It 'Initialize-PSEquilateralTriangle' { + # a simple test to create an object + #$NewObject = Initialize-PSEquilateralTriangle -ShapeType "TEST_VALUE" -TriangleType "TEST_VALUE" + #$NewObject | Should -BeOfType EquilateralTriangle + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/File.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/File.Tests.ps1 new file mode 100644 index 000000000000..9ea991f0357d --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/File.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSFile' { + Context 'PSFile' { + It 'Initialize-PSFile' { + # a simple test to create an object + #$NewObject = Initialize-PSFile -SourceURI "TEST_VALUE" + #$NewObject | Should -BeOfType File + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/FileSchemaTestClass.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/FileSchemaTestClass.Tests.ps1 new file mode 100644 index 000000000000..e6850286c3a7 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/FileSchemaTestClass.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSFileSchemaTestClass' { + Context 'PSFileSchemaTestClass' { + It 'Initialize-PSFileSchemaTestClass' { + # a simple test to create an object + #$NewObject = Initialize-PSFileSchemaTestClass -File "TEST_VALUE" -Files "TEST_VALUE" + #$NewObject | Should -BeOfType FileSchemaTestClass + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Foo.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Foo.Tests.ps1 new file mode 100644 index 000000000000..98cc3a96fa70 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Foo.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSFoo' { + Context 'PSFoo' { + It 'Initialize-PSFoo' { + # a simple test to create an object + #$NewObject = Initialize-PSFoo -Bar "TEST_VALUE" + #$NewObject | Should -BeOfType Foo + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/FormatTest.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/FormatTest.Tests.ps1 new file mode 100644 index 000000000000..6cdb13c999b2 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/FormatTest.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSFormatTest' { + Context 'PSFormatTest' { + It 'Initialize-PSFormatTest' { + # a simple test to create an object + #$NewObject = Initialize-PSFormatTest -Integer "TEST_VALUE" -Int32 "TEST_VALUE" -Int64 "TEST_VALUE" -Number "TEST_VALUE" -Float "TEST_VALUE" -Double "TEST_VALUE" -Decimal "TEST_VALUE" -String "TEST_VALUE" -Byte "TEST_VALUE" -Binary "TEST_VALUE" -Date "TEST_VALUE" -DateTime "TEST_VALUE" -Uuid "TEST_VALUE" -Password "TEST_VALUE" -PatternWithDigits "TEST_VALUE" -PatternWithDigitsAndDelimiter "TEST_VALUE" + #$NewObject | Should -BeOfType FormatTest + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Fruit.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Fruit.Tests.ps1 new file mode 100644 index 000000000000..897b03f23dcd --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Fruit.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSFruit' { + Context 'PSFruit' { + It 'Initialize-PSFruit' { + # a simple test to create an object + #$NewObject = Initialize-PSFruit -Color "TEST_VALUE" -Cultivar "TEST_VALUE" -Origin "TEST_VALUE" -LengthCm "TEST_VALUE" + #$NewObject | Should -BeOfType Fruit + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/FruitReq.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/FruitReq.Tests.ps1 new file mode 100644 index 000000000000..c149369b4626 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/FruitReq.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSFruitReq' { + Context 'PSFruitReq' { + It 'Initialize-PSFruitReq' { + # a simple test to create an object + #$NewObject = Initialize-PSFruitReq -Cultivar "TEST_VALUE" -Mealy "TEST_VALUE" -LengthCm "TEST_VALUE" -Sweet "TEST_VALUE" + #$NewObject | Should -BeOfType FruitReq + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/GmFruit.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/GmFruit.Tests.ps1 new file mode 100644 index 000000000000..6b91433b9b26 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/GmFruit.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSGmFruit' { + Context 'PSGmFruit' { + It 'Initialize-PSGmFruit' { + # a simple test to create an object + #$NewObject = Initialize-PSGmFruit -Color "TEST_VALUE" -Cultivar "TEST_VALUE" -Origin "TEST_VALUE" -LengthCm "TEST_VALUE" + #$NewObject | Should -BeOfType GmFruit + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/GrandparentAnimal.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/GrandparentAnimal.Tests.ps1 new file mode 100644 index 000000000000..f22b1fe3af7c --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/GrandparentAnimal.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSGrandparentAnimal' { + Context 'PSGrandparentAnimal' { + It 'Initialize-PSGrandparentAnimal' { + # a simple test to create an object + #$NewObject = Initialize-PSGrandparentAnimal -PetType "TEST_VALUE" + #$NewObject | Should -BeOfType GrandparentAnimal + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/HasOnlyReadOnly.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/HasOnlyReadOnly.Tests.ps1 new file mode 100644 index 000000000000..4235a31130e8 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/HasOnlyReadOnly.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSHasOnlyReadOnly' { + Context 'PSHasOnlyReadOnly' { + It 'Initialize-PSHasOnlyReadOnly' { + # a simple test to create an object + #$NewObject = Initialize-PSHasOnlyReadOnly -Bar "TEST_VALUE" -Foo "TEST_VALUE" + #$NewObject | Should -BeOfType HasOnlyReadOnly + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/HealthCheckResult.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/HealthCheckResult.Tests.ps1 new file mode 100644 index 000000000000..f46e6ba1a78a --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/HealthCheckResult.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSHealthCheckResult' { + Context 'PSHealthCheckResult' { + It 'Initialize-PSHealthCheckResult' { + # a simple test to create an object + #$NewObject = Initialize-PSHealthCheckResult -NullableMessage "TEST_VALUE" + #$NewObject | Should -BeOfType HealthCheckResult + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/InlineResponseDefault.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/InlineResponseDefault.Tests.ps1 new file mode 100644 index 000000000000..822b1d36d66d --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/InlineResponseDefault.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSInlineResponseDefault' { + Context 'PSInlineResponseDefault' { + It 'Initialize-PSInlineResponseDefault' { + # a simple test to create an object + #$NewObject = Initialize-PSInlineResponseDefault -String "TEST_VALUE" + #$NewObject | Should -BeOfType InlineResponseDefault + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/IsoscelesTriangle.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/IsoscelesTriangle.Tests.ps1 new file mode 100644 index 000000000000..0f49e370772f --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/IsoscelesTriangle.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSIsoscelesTriangle' { + Context 'PSIsoscelesTriangle' { + It 'Initialize-PSIsoscelesTriangle' { + # a simple test to create an object + #$NewObject = Initialize-PSIsoscelesTriangle -ShapeType "TEST_VALUE" -TriangleType "TEST_VALUE" + #$NewObject | Should -BeOfType IsoscelesTriangle + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/List.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/List.Tests.ps1 new file mode 100644 index 000000000000..991de93aa475 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/List.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSList' { + Context 'PSList' { + It 'Initialize-PSList' { + # a simple test to create an object + #$NewObject = Initialize-PSList -Var123List "TEST_VALUE" + #$NewObject | Should -BeOfType List + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Mammal.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Mammal.Tests.ps1 new file mode 100644 index 000000000000..0093186d8cb0 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Mammal.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSMammal' { + Context 'PSMammal' { + It 'Initialize-PSMammal' { + # a simple test to create an object + #$NewObject = Initialize-PSMammal -HasBaleen "TEST_VALUE" -HasTeeth "TEST_VALUE" -ClassName "TEST_VALUE" -Type "TEST_VALUE" + #$NewObject | Should -BeOfType Mammal + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/MapTest.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/MapTest.Tests.ps1 new file mode 100644 index 000000000000..128d1f71f353 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/MapTest.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSMapTest' { + Context 'PSMapTest' { + It 'Initialize-PSMapTest' { + # a simple test to create an object + #$NewObject = Initialize-PSMapTest -MapMapOfString "TEST_VALUE" -MapOfEnumString "TEST_VALUE" -DirectMap "TEST_VALUE" -IndirectMap "TEST_VALUE" + #$NewObject | Should -BeOfType MapTest + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/MixedPropertiesAndAdditionalPropertiesClass.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/MixedPropertiesAndAdditionalPropertiesClass.Tests.ps1 new file mode 100644 index 000000000000..64611f06da62 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/MixedPropertiesAndAdditionalPropertiesClass.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSMixedPropertiesAndAdditionalPropertiesClass' { + Context 'PSMixedPropertiesAndAdditionalPropertiesClass' { + It 'Initialize-PSMixedPropertiesAndAdditionalPropertiesClass' { + # a simple test to create an object + #$NewObject = Initialize-PSMixedPropertiesAndAdditionalPropertiesClass -Uuid "TEST_VALUE" -DateTime "TEST_VALUE" -Map "TEST_VALUE" + #$NewObject | Should -BeOfType MixedPropertiesAndAdditionalPropertiesClass + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Model200Response.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Model200Response.Tests.ps1 new file mode 100644 index 000000000000..c7765ef03ecd --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Model200Response.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSModel200Response' { + Context 'PSModel200Response' { + It 'Initialize-PSModel200Response' { + # a simple test to create an object + #$NewObject = Initialize-PSModel200Response -Name "TEST_VALUE" -Class "TEST_VALUE" + #$NewObject | Should -BeOfType Model200Response + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/ModelReturn.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/ModelReturn.Tests.ps1 new file mode 100644 index 000000000000..16a8c142bc63 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/ModelReturn.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSModelReturn' { + Context 'PSModelReturn' { + It 'Initialize-PSModelReturn' { + # a simple test to create an object + #$NewObject = Initialize-PSModelReturn -VarReturn "TEST_VALUE" + #$NewObject | Should -BeOfType ModelReturn + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Name.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Name.Tests.ps1 new file mode 100644 index 000000000000..ee7f033af661 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Name.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSName' { + Context 'PSName' { + It 'Initialize-PSName' { + # a simple test to create an object + #$NewObject = Initialize-PSName -Name "TEST_VALUE" -SnakeCase "TEST_VALUE" -Property "TEST_VALUE" -Var123Number "TEST_VALUE" + #$NewObject | Should -BeOfType Name + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/NullableClass.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/NullableClass.Tests.ps1 new file mode 100644 index 000000000000..fe7df5278ce5 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/NullableClass.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSNullableClass' { + Context 'PSNullableClass' { + It 'Initialize-PSNullableClass' { + # a simple test to create an object + #$NewObject = Initialize-PSNullableClass -IntegerProp "TEST_VALUE" -NumberProp "TEST_VALUE" -BooleanProp "TEST_VALUE" -StringProp "TEST_VALUE" -DateProp "TEST_VALUE" -DatetimeProp "TEST_VALUE" -ArrayNullableProp "TEST_VALUE" -ArrayAndItemsNullableProp "TEST_VALUE" -ArrayItemsNullable "TEST_VALUE" -ObjectNullableProp "TEST_VALUE" -ObjectAndItemsNullableProp "TEST_VALUE" -ObjectItemsNullable "TEST_VALUE" + #$NewObject | Should -BeOfType NullableClass + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/NullableShape.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/NullableShape.Tests.ps1 new file mode 100644 index 000000000000..4c66304bbe4f --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/NullableShape.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSNullableShape' { + Context 'PSNullableShape' { + It 'Initialize-PSNullableShape' { + # a simple test to create an object + #$NewObject = Initialize-PSNullableShape -ShapeType "TEST_VALUE" -TriangleType "TEST_VALUE" -QuadrilateralType "TEST_VALUE" + #$NewObject | Should -BeOfType NullableShape + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/NumberOnly.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/NumberOnly.Tests.ps1 new file mode 100644 index 000000000000..923419320e95 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/NumberOnly.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSNumberOnly' { + Context 'PSNumberOnly' { + It 'Initialize-PSNumberOnly' { + # a simple test to create an object + #$NewObject = Initialize-PSNumberOnly -JustNumber "TEST_VALUE" + #$NewObject | Should -BeOfType NumberOnly + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/ObjectWithDeprecatedFields.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/ObjectWithDeprecatedFields.Tests.ps1 new file mode 100644 index 000000000000..10ae61483760 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/ObjectWithDeprecatedFields.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSObjectWithDeprecatedFields' { + Context 'PSObjectWithDeprecatedFields' { + It 'Initialize-PSObjectWithDeprecatedFields' { + # a simple test to create an object + #$NewObject = Initialize-PSObjectWithDeprecatedFields -Uuid "TEST_VALUE" -Id "TEST_VALUE" -DeprecatedRef "TEST_VALUE" -Bars "TEST_VALUE" + #$NewObject | Should -BeOfType ObjectWithDeprecatedFields + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/OuterComposite.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/OuterComposite.Tests.ps1 new file mode 100644 index 000000000000..0382b18586b0 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/OuterComposite.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSOuterComposite' { + Context 'PSOuterComposite' { + It 'Initialize-PSOuterComposite' { + # a simple test to create an object + #$NewObject = Initialize-PSOuterComposite -MyNumber "TEST_VALUE" -MyString "TEST_VALUE" -MyBoolean "TEST_VALUE" + #$NewObject | Should -BeOfType OuterComposite + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/OuterEnum.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/OuterEnum.Tests.ps1 new file mode 100644 index 000000000000..be5b62a9eb20 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/OuterEnum.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSOuterEnum' { + Context 'PSOuterEnum' { + It 'Initialize-PSOuterEnum' { + # a simple test to create an object + #$NewObject = Initialize-PSOuterEnum + #$NewObject | Should -BeOfType OuterEnum + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/OuterEnumDefaultValue.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/OuterEnumDefaultValue.Tests.ps1 new file mode 100644 index 000000000000..3992012be320 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/OuterEnumDefaultValue.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSOuterEnumDefaultValue' { + Context 'PSOuterEnumDefaultValue' { + It 'Initialize-PSOuterEnumDefaultValue' { + # a simple test to create an object + #$NewObject = Initialize-PSOuterEnumDefaultValue + #$NewObject | Should -BeOfType OuterEnumDefaultValue + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/OuterEnumInteger.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/OuterEnumInteger.Tests.ps1 new file mode 100644 index 000000000000..00d0eba96570 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/OuterEnumInteger.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSOuterEnumInteger' { + Context 'PSOuterEnumInteger' { + It 'Initialize-PSOuterEnumInteger' { + # a simple test to create an object + #$NewObject = Initialize-PSOuterEnumInteger + #$NewObject | Should -BeOfType OuterEnumInteger + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/OuterEnumIntegerDefaultValue.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/OuterEnumIntegerDefaultValue.Tests.ps1 new file mode 100644 index 000000000000..3f9f924aef26 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/OuterEnumIntegerDefaultValue.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSOuterEnumIntegerDefaultValue' { + Context 'PSOuterEnumIntegerDefaultValue' { + It 'Initialize-PSOuterEnumIntegerDefaultValue' { + # a simple test to create an object + #$NewObject = Initialize-PSOuterEnumIntegerDefaultValue + #$NewObject | Should -BeOfType OuterEnumIntegerDefaultValue + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/ParentPet.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/ParentPet.Tests.ps1 new file mode 100644 index 000000000000..cc9560dc885a --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/ParentPet.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSParentPet' { + Context 'PSParentPet' { + It 'Initialize-PSParentPet' { + # a simple test to create an object + #$NewObject = Initialize-PSParentPet -PetType "TEST_VALUE" + #$NewObject | Should -BeOfType ParentPet + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/PetWithRequiredTags.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/PetWithRequiredTags.Tests.ps1 new file mode 100644 index 000000000000..a3ad7a11dcca --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/PetWithRequiredTags.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSPetWithRequiredTags' { + Context 'PSPetWithRequiredTags' { + It 'Initialize-PSPetWithRequiredTags' { + # a simple test to create an object + #$NewObject = Initialize-PSPetWithRequiredTags -Id "TEST_VALUE" -Category "TEST_VALUE" -Name "TEST_VALUE" -PhotoUrls "TEST_VALUE" -Tags "TEST_VALUE" -Status "TEST_VALUE" + #$NewObject | Should -BeOfType PetWithRequiredTags + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Pig.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Pig.Tests.ps1 new file mode 100644 index 000000000000..4cc331028d5e --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Pig.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSPig' { + Context 'PSPig' { + It 'Initialize-PSPig' { + # a simple test to create an object + #$NewObject = Initialize-PSPig -ClassName "TEST_VALUE" + #$NewObject | Should -BeOfType Pig + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Quadrilateral.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Quadrilateral.Tests.ps1 new file mode 100644 index 000000000000..4a054b1a5f8c --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Quadrilateral.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSQuadrilateral' { + Context 'PSQuadrilateral' { + It 'Initialize-PSQuadrilateral' { + # a simple test to create an object + #$NewObject = Initialize-PSQuadrilateral -ShapeType "TEST_VALUE" -QuadrilateralType "TEST_VALUE" + #$NewObject | Should -BeOfType Quadrilateral + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/QuadrilateralInterface.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/QuadrilateralInterface.Tests.ps1 new file mode 100644 index 000000000000..0fd834fe34d4 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/QuadrilateralInterface.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSQuadrilateralInterface' { + Context 'PSQuadrilateralInterface' { + It 'Initialize-PSQuadrilateralInterface' { + # a simple test to create an object + #$NewObject = Initialize-PSQuadrilateralInterface -QuadrilateralType "TEST_VALUE" + #$NewObject | Should -BeOfType QuadrilateralInterface + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/ReadOnlyFirst.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/ReadOnlyFirst.Tests.ps1 new file mode 100644 index 000000000000..14260f1c8cc8 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/ReadOnlyFirst.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSReadOnlyFirst' { + Context 'PSReadOnlyFirst' { + It 'Initialize-PSReadOnlyFirst' { + # a simple test to create an object + #$NewObject = Initialize-PSReadOnlyFirst -Bar "TEST_VALUE" -Baz "TEST_VALUE" + #$NewObject | Should -BeOfType ReadOnlyFirst + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/ScaleneTriangle.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/ScaleneTriangle.Tests.ps1 new file mode 100644 index 000000000000..9e3e01ac3e5e --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/ScaleneTriangle.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSScaleneTriangle' { + Context 'PSScaleneTriangle' { + It 'Initialize-PSScaleneTriangle' { + # a simple test to create an object + #$NewObject = Initialize-PSScaleneTriangle -ShapeType "TEST_VALUE" -TriangleType "TEST_VALUE" + #$NewObject | Should -BeOfType ScaleneTriangle + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Shape.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Shape.Tests.ps1 new file mode 100644 index 000000000000..10c579fc7ec8 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Shape.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSShape' { + Context 'PSShape' { + It 'Initialize-PSShape' { + # a simple test to create an object + #$NewObject = Initialize-PSShape -ShapeType "TEST_VALUE" -TriangleType "TEST_VALUE" -QuadrilateralType "TEST_VALUE" + #$NewObject | Should -BeOfType Shape + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/ShapeInterface.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/ShapeInterface.Tests.ps1 new file mode 100644 index 000000000000..595cdcde2727 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/ShapeInterface.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSShapeInterface' { + Context 'PSShapeInterface' { + It 'Initialize-PSShapeInterface' { + # a simple test to create an object + #$NewObject = Initialize-PSShapeInterface -ShapeType "TEST_VALUE" + #$NewObject | Should -BeOfType ShapeInterface + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/ShapeOrNull.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/ShapeOrNull.Tests.ps1 new file mode 100644 index 000000000000..c8aa986e7c44 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/ShapeOrNull.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSShapeOrNull' { + Context 'PSShapeOrNull' { + It 'Initialize-PSShapeOrNull' { + # a simple test to create an object + #$NewObject = Initialize-PSShapeOrNull -ShapeType "TEST_VALUE" -TriangleType "TEST_VALUE" -QuadrilateralType "TEST_VALUE" + #$NewObject | Should -BeOfType ShapeOrNull + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/SimpleQuadrilateral.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/SimpleQuadrilateral.Tests.ps1 new file mode 100644 index 000000000000..891d4eea609a --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/SimpleQuadrilateral.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSSimpleQuadrilateral' { + Context 'PSSimpleQuadrilateral' { + It 'Initialize-PSSimpleQuadrilateral' { + # a simple test to create an object + #$NewObject = Initialize-PSSimpleQuadrilateral -ShapeType "TEST_VALUE" -QuadrilateralType "TEST_VALUE" + #$NewObject | Should -BeOfType SimpleQuadrilateral + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/SpecialModelName.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/SpecialModelName.Tests.ps1 new file mode 100644 index 000000000000..4eb3d0f163a3 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/SpecialModelName.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSSpecialModelName' { + Context 'PSSpecialModelName' { + It 'Initialize-PSSpecialModelName' { + # a simple test to create an object + #$NewObject = Initialize-PSSpecialModelName -SpecialPropertyName "TEST_VALUE" -SpecialModelName "TEST_VALUE" + #$NewObject | Should -BeOfType SpecialModelName + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Triangle.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Triangle.Tests.ps1 new file mode 100644 index 000000000000..b1b4af2efbb7 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Triangle.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSTriangle' { + Context 'PSTriangle' { + It 'Initialize-PSTriangle' { + # a simple test to create an object + #$NewObject = Initialize-PSTriangle -ShapeType "TEST_VALUE" -TriangleType "TEST_VALUE" + #$NewObject | Should -BeOfType Triangle + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/TriangleInterface.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/TriangleInterface.Tests.ps1 new file mode 100644 index 000000000000..630f18eb2d24 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/TriangleInterface.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSTriangleInterface' { + Context 'PSTriangleInterface' { + It 'Initialize-PSTriangleInterface' { + # a simple test to create an object + #$NewObject = Initialize-PSTriangleInterface -TriangleType "TEST_VALUE" + #$NewObject | Should -BeOfType TriangleInterface + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Whale.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Whale.Tests.ps1 new file mode 100644 index 000000000000..331782aa5563 --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Whale.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSWhale' { + Context 'PSWhale' { + It 'Initialize-PSWhale' { + # a simple test to create an object + #$NewObject = Initialize-PSWhale -HasBaleen "TEST_VALUE" -HasTeeth "TEST_VALUE" -ClassName "TEST_VALUE" + #$NewObject | Should -BeOfType Whale + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/tests/Model/Zebra.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Zebra.Tests.ps1 new file mode 100644 index 000000000000..36feac5c870c --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/Zebra.Tests.ps1 @@ -0,0 +1,17 @@ +# +# 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: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSZebra' { + Context 'PSZebra' { + It 'Initialize-PSZebra' { + # a simple test to create an object + #$NewObject = Initialize-PSZebra -Type "TEST_VALUE" -ClassName "TEST_VALUE" + #$NewObject | Should -BeOfType Zebra + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/python/petstore_api/apis/__init__.py b/samples/client/petstore/python/petstore_api/apis/__init__.py index 302dcf25c447..5ccd49eec8e0 100644 --- a/samples/client/petstore/python/petstore_api/apis/__init__.py +++ b/samples/client/petstore/python/petstore_api/apis/__init__.py @@ -6,7 +6,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from .api.another_fake_api import AnotherFakeApi +# from petstore_api.api.another_fake_api import AnotherFakeApi # # or import this package, but before doing it, use: # diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/apis/__init__.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/apis/__init__.py index 302dcf25c447..5ccd49eec8e0 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/apis/__init__.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/apis/__init__.py @@ -6,7 +6,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from .api.another_fake_api import AnotherFakeApi +# from petstore_api.api.another_fake_api import AnotherFakeApi # # or import this package, but before doing it, use: # diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb index bec2636f87aa..3b5b4288fa8d 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb @@ -54,9 +54,10 @@ def call_api(http_method, path, opts = {}) :client_cert => @config.ssl_client_cert, :client_key => @config.ssl_client_key } - - connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn| - conn.proxy = config.proxy if config.proxy + request_options = { + :params_encoder => @config.params_encoder + } + connection = Faraday.new(:url => config.base_url, :ssl => ssl_options, :request => request_options) do |conn| conn.request(:basic_auth, config.username, config.password) @config.configure_middleware(conn) if opts[:header_params]["Content-Type"] == "multipart/form-data" @@ -128,7 +129,7 @@ def build_request(http_method, path, request, opts = {}) request.body = req_body # Overload default options only if provided - request.options.params_encoding = @config.params_encoding if @config.params_encoding + request.options.params_encoder = @config.params_encoder if @config.params_encoder request.options.timeout = @config.timeout if @config.timeout request.options.verbose = @config.debugging if @config.debugging diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/configuration.rb b/samples/client/petstore/ruby-faraday/lib/petstore/configuration.rb index cebd309ed9a9..df46409f2b5f 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/configuration.rb @@ -125,12 +125,13 @@ class Configuration # HTTP Proxy settings attr_accessor :proxy - # Set this to customize parameters encoding of array parameter with multi collectionFormat. - # Default to nil. + # Set this to customize parameters encoder of array parameter. + # Default to nil. Faraday uses NestedParamsEncoder when nil. # - # @see The params_encoding option of Ethon. Related source code: - # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 - attr_accessor :params_encoding + # @see The params_encoder option of Faraday. Related source code: + # https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders + attr_accessor :params_encoder + attr_accessor :inject_format @@ -158,6 +159,7 @@ def initialize @timeout = 60 # return data as binary instead of file @return_binary_data = false + @params_encoder = nil @debugging = false @inject_format = false @force_ending_format = false diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 66da7ab833d2..0f31f5e3f9e9 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -133,6 +133,7 @@ class Configuration # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 attr_accessor :params_encoding + attr_accessor :inject_format attr_accessor :force_ending_format @@ -150,10 +151,10 @@ def initialize @client_side_validation = true @verify_ssl = true @verify_ssl_host = true - @params_encoding = nil @cert_file = nil @key_file = nil @timeout = 0 + @params_encoding = nil @debugging = false @inject_format = false @force_ending_format = false diff --git a/samples/client/petstore/spring-cloud-async/pom.xml b/samples/client/petstore/spring-cloud-async/pom.xml index a741d2049c42..5b7846a57eb0 100644 --- a/samples/client/petstore/spring-cloud-async/pom.xml +++ b/samples/client/petstore/spring-cloud-async/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 diff --git a/samples/client/petstore/spring-cloud-date-time/pom.xml b/samples/client/petstore/spring-cloud-date-time/pom.xml index bfa0e935b12f..82dd5ef60b8a 100644 --- a/samples/client/petstore/spring-cloud-date-time/pom.xml +++ b/samples/client/petstore/spring-cloud-date-time/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 diff --git a/samples/client/petstore/spring-cloud-spring-pageable/pom.xml b/samples/client/petstore/spring-cloud-spring-pageable/pom.xml index bfcf2704c96d..d792d0954fc3 100644 --- a/samples/client/petstore/spring-cloud-spring-pageable/pom.xml +++ b/samples/client/petstore/spring-cloud-spring-pageable/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 diff --git a/samples/client/petstore/spring-cloud/pom.xml b/samples/client/petstore/spring-cloud/pom.xml index a741d2049c42..5b7846a57eb0 100644 --- a/samples/client/petstore/spring-cloud/pom.xml +++ b/samples/client/petstore/spring-cloud/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 diff --git a/samples/client/petstore/spring-stubs/pom.xml b/samples/client/petstore/spring-stubs/pom.xml index b15974cadd9b..427ae554a225 100644 --- a/samples/client/petstore/spring-stubs/pom.xml +++ b/samples/client/petstore/spring-stubs/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 4.8.1 diff --git a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts index 7d715d7ea75b..84e004fa465c 100644 --- a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts +++ b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts @@ -59,10 +59,10 @@ export interface AdditionalPropertiesClass { 'map_with_undeclared_properties_anytype_2'?: object; /** * - * @type {{ [key: string]: object; }} + * @type {{ [key: string]: any; }} * @memberof AdditionalPropertiesClass */ - 'map_with_undeclared_properties_anytype_3'?: { [key: string]: object; }; + 'map_with_undeclared_properties_anytype_3'?: { [key: string]: any; }; /** * an object with no declared properties and no undeclared properties, hence it\'s an empty map. * @type {object} @@ -1706,7 +1706,7 @@ export interface Whale { * @interface Zebra */ export interface Zebra { - [key: string]: object | any; + [key: string]: any; /** * diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts index 62742e15f671..48600fbd0985 100644 --- a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts @@ -173,7 +173,7 @@ export interface ArrayTest { * @interface Banana */ export interface Banana { - [key: string]: object | any; + [key: string]: any; /** * diff --git a/samples/meta-codegen-kotlin/lib/src/main/kotlin/com/my/company/codegen/MyclientcodegenGenerator.kt b/samples/meta-codegen-kotlin/lib/src/main/kotlin/com/my/company/codegen/MyclientcodegenGenerator.kt index fa12a98b02ff..ab4fdbd49d45 100644 --- a/samples/meta-codegen-kotlin/lib/src/main/kotlin/com/my/company/codegen/MyclientcodegenGenerator.kt +++ b/samples/meta-codegen-kotlin/lib/src/main/kotlin/com/my/company/codegen/MyclientcodegenGenerator.kt @@ -2,7 +2,7 @@ package com.my.company.codegen import org.openapitools.codegen.* -import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.*; import java.util.* import java.io.File @@ -37,11 +37,11 @@ open class MyclientcodegenGenerator() : DefaultCodegen(), CodegenConfig { * Provides an opportunity to inspect and modify operation data before the code is generated. */ @Suppress("UNCHECKED_CAST") - override fun postProcessOperationsWithModels(objs: Map, allModels: List?): Map { + override fun postProcessOperationsWithModels(objs: OperationsMap, allModels: List?): OperationsMap { val results = super.postProcessOperationsWithModels(objs, allModels) - val ops = results["operations"] as Map - val opList = ops["operation"] as ArrayList + val ops = results.getOperations() + val opList = ops.getOperation() // iterate over the operation and perhaps modify something for (co: CodegenOperation in opList) { diff --git a/samples/meta-codegen/lib/src/main/java/com/my/company/codegen/MyclientcodegenGenerator.java b/samples/meta-codegen/lib/src/main/java/com/my/company/codegen/MyclientcodegenGenerator.java index 4921a12ce3a6..379443c0dfc5 100644 --- a/samples/meta-codegen/lib/src/main/java/com/my/company/codegen/MyclientcodegenGenerator.java +++ b/samples/meta-codegen/lib/src/main/java/com/my/company/codegen/MyclientcodegenGenerator.java @@ -1,7 +1,7 @@ package com.my.company.codegen; import org.openapitools.codegen.*; -import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.*; import io.swagger.models.properties.*; import java.util.*; @@ -36,18 +36,17 @@ public String getName() { /** * Provides an opportunity to inspect and modify operation data before the code is generated. */ - @SuppressWarnings("unchecked") @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { // to try debugging your code generator: // set a break point on the next line. // then debug the JUnit test called LaunchGeneratorInDebugger - Map results = super.postProcessOperationsWithModels(objs, allModels); + OperationsMap results = super.postProcessOperationsWithModels(objs, allModels); - Map ops = (Map)results.get("operations"); - ArrayList opList = (ArrayList)ops.get("operation"); + OperationMap ops = results.getOperations(); + List opList = ops.getOperation(); // iterate over the operation and perhaps modify something for(CodegenOperation co : opList){ @@ -196,4 +195,4 @@ public String escapeQuotationMark(String input) { //TODO: check that this logic is safe to escape quotation mark to avoid code injection return input.replace("\"", "\\\""); } -} \ No newline at end of file +} diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle index a9b6b1699278..b9afa56a8543 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle @@ -100,11 +100,11 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.6.5" jackson_version = "2.13.2" - jackson_databind_version = "2.13.2" + jackson_databind_version = "2.13.2.2" jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" jersey_version = "2.35" - junit_version = "4.13.2" + junit_version = "5.8.2" } dependencies { @@ -121,7 +121,12 @@ dependencies { implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +} + +test { + useJUnitPlatform() } javadoc { diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.sbt b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.sbt index 14e550fa04a0..f245414c4d59 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.sbt +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.sbt @@ -18,11 +18,10 @@ lazy val root = (project in file(".")). "org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.35", "com.fasterxml.jackson.core" % "jackson-core" % "2.13.2" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.2" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2" % "compile", - "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2.2" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.2" % "compile", "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.2" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test" + "org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test" ) ) diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml index 38d8c6e98ccd..424d8713c89d 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml @@ -336,7 +336,7 @@ 1.6.5 2.35 2.13.2 - 2.13.2 + 2.13.2.2 0.2.2 1.3.5 5.8.2 diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/apis/__init__.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/apis/__init__.py index 8bce252a2ed8..f3c051339da4 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/apis/__init__.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/apis/__init__.py @@ -6,7 +6,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from .api.usage_api import UsageApi +# from x_auth_id_alias.api.usage_api import UsageApi # # or import this package, but before doing it, use: # diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/configuration.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/configuration.rb index de03d94f7345..48587852664b 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/configuration.rb +++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/configuration.rb @@ -133,6 +133,7 @@ class Configuration # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 attr_accessor :params_encoding + attr_accessor :inject_format attr_accessor :force_ending_format @@ -150,10 +151,10 @@ def initialize @client_side_validation = true @verify_ssl = true @verify_ssl_host = true - @params_encoding = nil @cert_file = nil @key_file = nil @timeout = 0 + @params_encoding = nil @debugging = false @inject_format = false @force_ending_format = false diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/apis/__init__.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/apis/__init__.py index 09e1121e370b..21c779b74b34 100644 --- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/apis/__init__.py +++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/apis/__init__.py @@ -6,7 +6,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from .api.usage_api import UsageApi +# from dynamic_servers.api.usage_api import UsageApi # # or import this package, but before doing it, use: # diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/configuration.rb b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/configuration.rb index fd4209a89ae0..d5d7dacc8edd 100644 --- a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/configuration.rb +++ b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/configuration.rb @@ -133,6 +133,7 @@ class Configuration # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 attr_accessor :params_encoding + attr_accessor :inject_format attr_accessor :force_ending_format @@ -150,10 +151,10 @@ def initialize @client_side_validation = true @verify_ssl = true @verify_ssl_host = true - @params_encoding = nil @cert_file = nil @key_file = nil @timeout = 0 + @params_encoding = nil @debugging = false @inject_format = false @force_ending_format = false diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/configuration.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/configuration.rb index 56c3c1a3f8ed..641a0f31e582 100644 --- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/configuration.rb +++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/configuration.rb @@ -133,6 +133,7 @@ class Configuration # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 attr_accessor :params_encoding + attr_accessor :inject_format attr_accessor :force_ending_format @@ -150,10 +151,10 @@ def initialize @client_side_validation = true @verify_ssl = true @verify_ssl_host = true - @params_encoding = nil @cert_file = nil @key_file = nil @timeout = 0 + @params_encoding = nil @debugging = false @inject_format = false @force_ending_format = false diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_arrays.dart index bda9790c1049..2626b354264e 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_arrays.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_arrays.dart @@ -93,6 +93,8 @@ class EnumArraysJustSymbolEnum extends EnumClass { static const EnumArraysJustSymbolEnum greaterThanEqual = _$enumArraysJustSymbolEnum_greaterThanEqual; @BuiltValueEnumConst(wireName: r'$') static const EnumArraysJustSymbolEnum dollar = _$enumArraysJustSymbolEnum_dollar; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumArraysJustSymbolEnum unknownDefaultOpenApi = _$enumArraysJustSymbolEnum_unknownDefaultOpenApi; static Serializer get serializer => _$enumArraysJustSymbolEnumSerializer; @@ -108,6 +110,8 @@ class EnumArraysArrayEnumEnum extends EnumClass { static const EnumArraysArrayEnumEnum fish = _$enumArraysArrayEnumEnum_fish; @BuiltValueEnumConst(wireName: r'crab') static const EnumArraysArrayEnumEnum crab = _$enumArraysArrayEnumEnum_crab; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumArraysArrayEnumEnum unknownDefaultOpenApi = _$enumArraysArrayEnumEnum_unknownDefaultOpenApi; static Serializer get serializer => _$enumArraysArrayEnumEnumSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_test.dart index 7ca76d22fe0f..ff022e646e86 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_test.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_test.dart @@ -194,6 +194,8 @@ class EnumTestEnumStringEnum extends EnumClass { static const EnumTestEnumStringEnum lower = _$enumTestEnumStringEnum_lower; @BuiltValueEnumConst(wireName: r'') static const EnumTestEnumStringEnum empty = _$enumTestEnumStringEnum_empty; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumTestEnumStringEnum unknownDefaultOpenApi = _$enumTestEnumStringEnum_unknownDefaultOpenApi; static Serializer get serializer => _$enumTestEnumStringEnumSerializer; @@ -211,6 +213,8 @@ class EnumTestEnumStringRequiredEnum extends EnumClass { static const EnumTestEnumStringRequiredEnum lower = _$enumTestEnumStringRequiredEnum_lower; @BuiltValueEnumConst(wireName: r'') static const EnumTestEnumStringRequiredEnum empty = _$enumTestEnumStringRequiredEnum_empty; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumTestEnumStringRequiredEnum unknownDefaultOpenApi = _$enumTestEnumStringRequiredEnum_unknownDefaultOpenApi; static Serializer get serializer => _$enumTestEnumStringRequiredEnumSerializer; @@ -226,6 +230,8 @@ class EnumTestEnumIntegerEnum extends EnumClass { static const EnumTestEnumIntegerEnum number1 = _$enumTestEnumIntegerEnum_number1; @BuiltValueEnumConst(wireNumber: -1) static const EnumTestEnumIntegerEnum numberNegative1 = _$enumTestEnumIntegerEnum_numberNegative1; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const EnumTestEnumIntegerEnum unknownDefaultOpenApi = _$enumTestEnumIntegerEnum_unknownDefaultOpenApi; static Serializer get serializer => _$enumTestEnumIntegerEnumSerializer; @@ -241,6 +247,8 @@ class EnumTestEnumNumberEnum extends EnumClass { static const EnumTestEnumNumberEnum number1Period1 = _$enumTestEnumNumberEnum_number1Period1; @BuiltValueEnumConst(wireName: r'-1.2') static const EnumTestEnumNumberEnum numberNegative1Period2 = _$enumTestEnumNumberEnum_numberNegative1Period2; + @BuiltValueEnumConst(wireName: r'11184809', fallback: true) + static const EnumTestEnumNumberEnum unknownDefaultOpenApi = _$enumTestEnumNumberEnum_unknownDefaultOpenApi; static Serializer get serializer => _$enumTestEnumNumberEnumSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/map_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/map_test.dart index e5ae30f2290f..16df0490e164 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/map_test.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/map_test.dart @@ -122,6 +122,8 @@ class MapTestMapOfEnumStringEnum extends EnumClass { static const MapTestMapOfEnumStringEnum UPPER = _$mapTestMapOfEnumStringEnum_UPPER; @BuiltValueEnumConst(wireName: r'lower') static const MapTestMapOfEnumStringEnum lower = _$mapTestMapOfEnumStringEnum_lower; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const MapTestMapOfEnumStringEnum unknownDefaultOpenApi = _$mapTestMapOfEnumStringEnum_unknownDefaultOpenApi; static Serializer get serializer => _$mapTestMapOfEnumStringEnumSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_enum_class.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_enum_class.dart index ba6ca8c45dd3..f49be90d2bb3 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_enum_class.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_enum_class.dart @@ -16,6 +16,8 @@ class ModelEnumClass extends EnumClass { static const ModelEnumClass efg = _$efg; @BuiltValueEnumConst(wireName: r'(xyz)') static const ModelEnumClass leftParenthesisXyzRightParenthesis = _$leftParenthesisXyzRightParenthesis; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const ModelEnumClass unknownDefaultOpenApi = _$unknownDefaultOpenApi; static Serializer get serializer => _$modelEnumClassSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/order.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/order.dart index 3f9aed726558..507a1e3a98d4 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/order.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/order.dart @@ -159,6 +159,9 @@ class OrderStatusEnum extends EnumClass { /// Order Status @BuiltValueEnumConst(wireName: r'delivered') static const OrderStatusEnum delivered = _$orderStatusEnum_delivered; + /// Order Status + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OrderStatusEnum unknownDefaultOpenApi = _$orderStatusEnum_unknownDefaultOpenApi; static Serializer get serializer => _$orderStatusEnumSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum.dart index 6476ca57d462..882219e06cdc 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum.dart @@ -16,6 +16,8 @@ class OuterEnum extends EnumClass { static const OuterEnum approved = _$approved; @BuiltValueEnumConst(wireName: r'delivered') static const OuterEnum delivered = _$delivered; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OuterEnum unknownDefaultOpenApi = _$unknownDefaultOpenApi; static Serializer get serializer => _$outerEnumSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_default_value.dart index af04c76ed44e..77353c07711a 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_default_value.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_default_value.dart @@ -16,6 +16,8 @@ class OuterEnumDefaultValue extends EnumClass { static const OuterEnumDefaultValue approved = _$approved; @BuiltValueEnumConst(wireName: r'delivered') static const OuterEnumDefaultValue delivered = _$delivered; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OuterEnumDefaultValue unknownDefaultOpenApi = _$unknownDefaultOpenApi; static Serializer get serializer => _$outerEnumDefaultValueSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer.dart index c3b4b7d8f5d8..9b179131475c 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer.dart @@ -16,6 +16,8 @@ class OuterEnumInteger extends EnumClass { static const OuterEnumInteger number1 = _$number1; @BuiltValueEnumConst(wireNumber: 2) static const OuterEnumInteger number2 = _$number2; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const OuterEnumInteger unknownDefaultOpenApi = _$unknownDefaultOpenApi; static Serializer get serializer => _$outerEnumIntegerSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer_default_value.dart index cf71a0217650..ded5b2c72318 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer_default_value.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer_default_value.dart @@ -16,6 +16,8 @@ class OuterEnumIntegerDefaultValue extends EnumClass { static const OuterEnumIntegerDefaultValue number1 = _$number1; @BuiltValueEnumConst(wireNumber: 2) static const OuterEnumIntegerDefaultValue number2 = _$number2; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const OuterEnumIntegerDefaultValue unknownDefaultOpenApi = _$unknownDefaultOpenApi; static Serializer get serializer => _$outerEnumIntegerDefaultValueSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/pet.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/pet.dart index 4aea3f370f99..8ed90d104aa2 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/pet.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/pet.dart @@ -156,6 +156,9 @@ class PetStatusEnum extends EnumClass { /// pet status in the store @BuiltValueEnumConst(wireName: r'sold') static const PetStatusEnum sold = _$petStatusEnum_sold; + /// pet status in the store + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const PetStatusEnum unknownDefaultOpenApi = _$petStatusEnum_unknownDefaultOpenApi; static Serializer get serializer => _$petStatusEnumSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart index a599897e9377..e71be9843071 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart @@ -151,6 +151,9 @@ class OrderStatusEnum extends EnumClass { /// Order Status @BuiltValueEnumConst(wireName: r'delivered') static const OrderStatusEnum delivered = _$orderStatusEnum_delivered; + /// Order Status + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OrderStatusEnum unknownDefaultOpenApi = _$orderStatusEnum_unknownDefaultOpenApi; static Serializer get serializer => _$orderStatusEnumSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart index e18fe54222c6..28551d4594eb 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart @@ -147,6 +147,9 @@ class PetStatusEnum extends EnumClass { /// pet status in the store @BuiltValueEnumConst(wireName: r'sold') static const PetStatusEnum sold = _$petStatusEnum_sold; + /// pet status in the store + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const PetStatusEnum unknownDefaultOpenApi = _$petStatusEnum_unknownDefaultOpenApi; static Serializer get serializer => _$petStatusEnumSerializer; diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle index 4907b80214d3..0bec3bb5f3da 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle @@ -100,11 +100,11 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.6.5" jackson_version = "2.13.2" - jackson_databind_version = "2.13.2" + jackson_databind_version = "2.13.2.2" jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" jersey_version = "2.35" - junit_version = "4.13.2" + junit_version = "5.8.2" } dependencies { @@ -121,7 +121,12 @@ dependencies { implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +} + +test { + useJUnitPlatform() } javadoc { diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.sbt b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.sbt index 89eb21a0c728..3ecfc035b114 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.sbt +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.sbt @@ -18,11 +18,10 @@ lazy val root = (project in file(".")). "org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.35", "com.fasterxml.jackson.core" % "jackson-core" % "2.13.2" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.2" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2" % "compile", - "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2.2" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.2" % "compile", "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.2" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test" + "org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test" ) ) diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/pom.xml b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/pom.xml index a05e5a5de25e..fe9ea83f94d1 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/pom.xml +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/pom.xml @@ -336,7 +336,7 @@ 1.6.5 2.35 2.13.2 - 2.13.2 + 2.13.2.2 0.2.2 1.3.5 5.8.2 diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle b/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle index e97b780d670c..0bd0fe1b0490 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle +++ b/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle @@ -100,11 +100,11 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.6.5" jackson_version = "2.13.2" - jackson_databind_version = "2.13.2" + jackson_databind_version = "2.13.2.2" jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" jersey_version = "2.35" - junit_version = "4.13.2" + junit_version = "5.8.2" scribejava_apis_version = "8.3.1" tomitribe_http_signatures_version = "1.7" } @@ -125,7 +125,12 @@ dependencies { implementation "com.github.scribejava:scribejava-apis:$scribejava_apis_version" implementation "org.tomitribe:tomitribe-http-signatures:$tomitribe_http_signatures_version" implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +} + +test { + useJUnitPlatform() } javadoc { diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt b/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt index 5d5d8e578965..a978449bb84f 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt +++ b/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt @@ -18,13 +18,12 @@ lazy val root = (project in file(".")). "org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.35", "com.fasterxml.jackson.core" % "jackson-core" % "2.13.2" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.2" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2" % "compile", - "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2.2" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.2" % "compile", "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", "org.tomitribe" % "tomitribe-http-signatures" % "1.7" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.2" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test" + "org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test" ) ) diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml b/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml index e70169d750b0..addf6fc45b49 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml +++ b/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml @@ -346,7 +346,7 @@ 1.6.5 2.35 2.13.2 - 2.13.2 + 2.13.2.2 0.2.2 1.3.5 5.8.2 diff --git a/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md index 6ec2e771f866..163f2000ca7c 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md @@ -68,7 +68,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation +200 | ApiResponseFor200 | successful operation #### ApiResponseFor200 Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-experimental/docs/DateTimeTest.md b/samples/openapi3/client/petstore/python-experimental/docs/DateTimeTest.md index 408c95d0f9ae..4dd977eac981 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/DateTimeTest.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/DateTimeTest.md @@ -2,7 +2,7 @@ Type | Description | Notes ------------- | ------------- | ------------- -**datetime** | | defaults to isoparse('2010-01-01T10:10:10.000111+01:00') +**datetime** | | defaults to 2010-01-01T10:10:10.000111+01:00 [[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/openapi3/client/petstore/python-experimental/docs/DefaultApi.md b/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md index 768fca5bd474..71f36c7bc6b3 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md @@ -44,7 +44,7 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -default | ApiResponseForDefault | response +default | ApiResponseForDefault | response #### ApiResponseForDefault Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md b/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md index 6633238a2dc9..a7d72fcc89f0 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md @@ -95,7 +95,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Got object with additional properties with array of enums +200 | ApiResponseFor200 | Got object with additional properties with array of enums #### ApiResponseFor200 Name | Type | Description | Notes @@ -180,7 +180,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Output model +200 | ApiResponseFor200 | Output model #### ApiResponseFor200 Name | Type | Description | Notes @@ -264,7 +264,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Got named array of enums +200 | ApiResponseFor200 | Got named array of enums #### ApiResponseFor200 Name | Type | Description | Notes @@ -352,7 +352,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Success +200 | ApiResponseFor200 | Success #### ApiResponseFor200 Name | Type | Description | Notes @@ -457,7 +457,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Success +200 | ApiResponseFor200 | Success #### ApiResponseFor200 Name | Type | Description | Notes @@ -533,7 +533,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Output boolean +200 | ApiResponseFor200 | Output boolean #### ApiResponseFor200 Name | Type | Description | Notes @@ -636,7 +636,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Success +200 | ApiResponseFor200 | Success #### ApiResponseFor200 Name | Type | Description | Notes @@ -716,7 +716,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation +200 | ApiResponseFor200 | successful operation #### ApiResponseFor200 Name | Type | Description | Notes @@ -766,7 +766,7 @@ with petstore_api.ApiClient(configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only optional values - body = ComposedOneOfDifferentTypes() + body = ComposedOneOfDifferentTypes(None) try: api_response = api_instance.composed_one_of_different_types( body=body, @@ -799,7 +799,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Output model +200 | ApiResponseFor200 | Output model #### ApiResponseFor200 Name | Type | Description | Notes @@ -866,12 +866,12 @@ with petstore_api.ApiClient(configuration) as api_client: number=32.1, _float=3.14, double=67.8, - string="a", - pattern_without_delimiter="AUR,rZ#UM/?R,Fp^l6$ARjbhJk C", + string="A", + pattern_without_delimiter="Aj", byte='YQ==', binary=open('/path/to/file', 'rb'), - date=isoparse('1970-01-01').date(), - date_time=isoparse('2020-02-02T20:20:20.22222Z'), + date="1970-01-01", + date_time="2020-02-02T20:20:20.222220Z", password="password_example", callback="callback_example", ) @@ -911,7 +911,7 @@ Name | Type | Description | Notes **byte** | **str** | None | **binary** | **file_type** | None | [optional] **date** | **date** | None | [optional] -**dateTime** | **datetime** | None | [optional] if omitted the server will use the default value of isoparse('2010-02-01T10:20:10.11111+01:00') +**dateTime** | **datetime** | None | [optional] if omitted the server will use the default value of 2010-02-01T10:20:10.11111+01:00 **password** | **str** | None | [optional] **callback** | **str** | None | [optional] **any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] @@ -921,8 +921,8 @@ Name | Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -400 | ApiResponseFor400 | Invalid username supplied -404 | ApiResponseFor404 | User not found +400 | ApiResponseFor400 | Invalid username supplied +404 | ApiResponseFor404 | User not found #### ApiResponseFor400 Name | Type | Description | Notes @@ -1085,8 +1085,8 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -400 | ApiResponseFor400 | Invalid request -404 | ApiResponseFor404 | Not found +400 | ApiResponseFor400 | Invalid request +404 | ApiResponseFor404 | Not found #### ApiResponseFor400 Name | Type | Description | Notes @@ -1150,7 +1150,7 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | The instance started successfully +200 | ApiResponseFor200 | The instance started successfully #### ApiResponseFor200 Name | Type | Description | Notes @@ -1315,7 +1315,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -400 | ApiResponseFor400 | Someting wrong +400 | ApiResponseFor400 | Someting wrong #### ApiResponseFor400 Name | Type | Description | Notes @@ -1391,7 +1391,7 @@ Name | Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation +200 | ApiResponseFor200 | successful operation #### ApiResponseFor200 Name | Type | Description | Notes @@ -1434,12 +1434,12 @@ with petstore_api.ApiClient(configuration) as api_client: # example passing only optional values query_params = { - 'compositionAtRoot': , + 'compositionAtRoot': None, 'compositionInProperty': dict( - some_prop=, + some_prop=None, ), } - body = + body = None try: # testing composed schemas at inline locations api_response = api_instance.inline_composition( @@ -1506,7 +1506,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | success +200 | ApiResponseFor200 | success #### ApiResponseFor200 Name | Type | Description | Notes @@ -1600,7 +1600,7 @@ Name | Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation +200 | ApiResponseFor200 | successful operation #### ApiResponseFor200 Name | Type | Description | Notes @@ -1681,7 +1681,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Output mammal +200 | ApiResponseFor200 | Output mammal #### ApiResponseFor200 Name | Type | Description | Notes @@ -1764,7 +1764,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Output number +200 | ApiResponseFor200 | Output number #### ApiResponseFor200 Name | Type | Description | Notes @@ -1853,7 +1853,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | ok +200 | ApiResponseFor200 | ok #### ApiResponseFor200 Name | Type | Description | Notes @@ -1934,7 +1934,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Output model +200 | ApiResponseFor200 | Output model #### ApiResponseFor200 Name | Type | Description | Notes @@ -2234,7 +2234,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | success +200 | ApiResponseFor200 | success #### ApiResponseFor200 Name | Type | Description | Notes @@ -2372,7 +2372,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Success +200 | ApiResponseFor200 | Success #### ApiResponseFor200 Name | Type | Description | Notes @@ -2455,7 +2455,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | ok +200 | ApiResponseFor200 | ok #### ApiResponseFor200 Name | Type | Description | Notes @@ -2531,7 +2531,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Output string +200 | ApiResponseFor200 | Output string #### ApiResponseFor200 Name | Type | Description | Notes @@ -2614,7 +2614,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Output enum +200 | ApiResponseFor200 | Output enum #### ApiResponseFor200 Name | Type | Description | Notes @@ -2697,7 +2697,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation +200 | ApiResponseFor200 | successful operation #### ApiResponseFor200 Name | Type | Description | Notes @@ -2787,7 +2787,7 @@ Name | Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation +200 | ApiResponseFor200 | successful operation #### ApiResponseFor200 Name | Type | Description | Notes @@ -2875,7 +2875,7 @@ Name | Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation +200 | ApiResponseFor200 | successful operation #### ApiResponseFor200 Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md index f5ddd9538973..1a956e633dbb 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md @@ -79,7 +79,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation +200 | ApiResponseFor200 | successful operation #### ApiResponseFor200 Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md b/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md index c979cf2db2bf..7b9ab23bc5db 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md @@ -167,8 +167,8 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | Ok -405 | ApiResponseFor405 | Invalid input +200 | ApiResponseFor200 | Ok +405 | ApiResponseFor405 | Invalid input #### ApiResponseFor200 Name | Type | Description | Notes @@ -298,7 +298,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -400 | ApiResponseFor400 | Invalid pet value +400 | ApiResponseFor400 | Invalid pet value #### ApiResponseFor400 Name | Type | Description | Notes @@ -456,8 +456,8 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation -400 | ApiResponseFor400 | Invalid status value +200 | ApiResponseFor200 | successful operation +400 | ApiResponseFor400 | Invalid status value #### ApiResponseFor200 Name | Type | Description | Notes @@ -634,8 +634,8 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation -400 | ApiResponseFor400 | Invalid tag value +200 | ApiResponseFor200 | successful operation +400 | ApiResponseFor400 | Invalid tag value #### ApiResponseFor200 Name | Type | Description | Notes @@ -749,9 +749,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation -400 | ApiResponseFor400 | Invalid ID supplied -404 | ApiResponseFor404 | Pet not found +200 | ApiResponseFor200 | successful operation +400 | ApiResponseFor400 | Invalid ID supplied +404 | ApiResponseFor404 | Pet not found #### ApiResponseFor200 Name | Type | Description | Notes @@ -946,9 +946,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -400 | ApiResponseFor400 | Invalid ID supplied -404 | ApiResponseFor404 | Pet not found -405 | ApiResponseFor405 | Validation exception +400 | ApiResponseFor400 | Invalid ID supplied +404 | ApiResponseFor404 | Pet not found +405 | ApiResponseFor405 | Validation exception #### ApiResponseFor400 Name | Type | Description | Notes @@ -1082,7 +1082,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -405 | ApiResponseFor405 | Invalid input +405 | ApiResponseFor405 | Invalid input #### ApiResponseFor405 Name | Type | Description | Notes @@ -1206,7 +1206,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation +200 | ApiResponseFor200 | successful operation #### ApiResponseFor200 Name | Type | Description | Notes @@ -1336,7 +1336,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation +200 | ApiResponseFor200 | successful operation #### ApiResponseFor200 Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md b/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md index 80f9a368f5fd..9840cc8134c1 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md @@ -72,8 +72,8 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -400 | ApiResponseFor400 | Invalid ID supplied -404 | ApiResponseFor404 | Order not found +400 | ApiResponseFor400 | Invalid ID supplied +404 | ApiResponseFor404 | Order not found #### ApiResponseFor400 Name | Type | Description | Notes @@ -149,7 +149,7 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation +200 | ApiResponseFor200 | successful operation #### ApiResponseFor200 Name | Type | Description | Notes @@ -240,9 +240,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation -400 | ApiResponseFor400 | Invalid ID supplied -404 | ApiResponseFor404 | Order not found +200 | ApiResponseFor200 | successful operation +400 | ApiResponseFor400 | Invalid ID supplied +404 | ApiResponseFor404 | Order not found #### ApiResponseFor200 Name | Type | Description | Notes @@ -314,7 +314,7 @@ with petstore_api.ApiClient(configuration) as api_client: id=1, pet_id=1, quantity=1, - ship_date=isoparse('2020-02-02T20:20:20.000222Z'), + ship_date="2020-02-02T20:20:20.000222Z", status="placed", complete=False, ) @@ -351,8 +351,8 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation -400 | ApiResponseFor400 | Invalid Order +200 | ApiResponseFor200 | successful operation +400 | ApiResponseFor400 | Invalid Order #### ApiResponseFor200 Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md b/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md index 5fc0764d75ee..1bd5e09f1a4a 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md @@ -84,7 +84,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -default | ApiResponseForDefault | successful operation +default | ApiResponseForDefault | successful operation #### ApiResponseForDefault Name | Type | Description | Notes @@ -173,7 +173,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -default | ApiResponseForDefault | successful operation +default | ApiResponseForDefault | successful operation #### ApiResponseForDefault Name | Type | Description | Notes @@ -262,7 +262,7 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -default | ApiResponseForDefault | successful operation +default | ApiResponseForDefault | successful operation #### ApiResponseForDefault Name | Type | Description | Notes @@ -343,8 +343,8 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -400 | ApiResponseFor400 | Invalid username supplied -404 | ApiResponseFor404 | User not found +400 | ApiResponseFor400 | Invalid username supplied +404 | ApiResponseFor404 | User not found #### ApiResponseFor400 Name | Type | Description | Notes @@ -433,9 +433,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation -400 | ApiResponseFor400 | Invalid username supplied -404 | ApiResponseFor404 | User not found +200 | ApiResponseFor200 | successful operation +400 | ApiResponseFor400 | Invalid username supplied +404 | ApiResponseFor404 | User not found #### ApiResponseFor200 Name | Type | Description | Notes @@ -551,8 +551,8 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | ApiResponseFor200 | successful operation -400 | ApiResponseFor400 | Invalid username/password supplied +200 | ApiResponseFor200 | successful operation +400 | ApiResponseFor400 | Invalid username/password supplied #### ApiResponseFor200 Name | Type | Description | Notes @@ -649,7 +649,7 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -default | ApiResponseForDefault | successful operation +default | ApiResponseForDefault | successful operation #### ApiResponseForDefault Name | Type | Description | Notes @@ -756,8 +756,8 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -400 | ApiResponseFor400 | Invalid user supplied -404 | ApiResponseFor404 | User not found +400 | ApiResponseFor400 | Invalid user supplied +404 | ApiResponseFor404 | User not found #### ApiResponseFor400 Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/another_fake_api_endpoints/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/another_fake_api_endpoints/__init__.py new file mode 100644 index 000000000000..464f50cb8ecd --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/another_fake_api_endpoints/__init__.py @@ -0,0 +1,3 @@ +# do not import all endpoints into this module because that uses a lot of memory and stack frames +# if you need the ability to import all endpoints from this module, import them with +# from petstore_api.api.another_fake_api import AnotherFakeApi diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/default_api_endpoints/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/default_api_endpoints/__init__.py new file mode 100644 index 000000000000..9dad5771ea69 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/default_api_endpoints/__init__.py @@ -0,0 +1,3 @@ +# do not import all endpoints into this module because that uses a lot of memory and stack frames +# if you need the ability to import all endpoints from this module, import them with +# from petstore_api.api.default_api import DefaultApi diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api_endpoints/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api_endpoints/__init__.py new file mode 100644 index 000000000000..46b30d43ce6a --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api_endpoints/__init__.py @@ -0,0 +1,3 @@ +# do not import all endpoints into this module because that uses a lot of memory and stack frames +# if you need the ability to import all endpoints from this module, import them with +# from petstore_api.api.fake_api import FakeApi diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags123_api_endpoints/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags123_api_endpoints/__init__.py new file mode 100644 index 000000000000..51f0b89af111 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags123_api_endpoints/__init__.py @@ -0,0 +1,3 @@ +# do not import all endpoints into this module because that uses a lot of memory and stack frames +# if you need the ability to import all endpoints from this module, import them with +# from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api_endpoints/classname.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api_endpoints/classname.py deleted file mode 100644 index 99b59bc4d6bb..000000000000 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api_endpoints/classname.py +++ /dev/null @@ -1,170 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import re # noqa: F401 -import sys # noqa: F401 -import typing -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -import decimal # noqa: F401 -from datetime import date, datetime # noqa: F401 -from frozendict import frozendict # noqa: F401 - -from petstore_api.schemas import ( # noqa: F401 - AnyTypeSchema, - ComposedSchema, - DictSchema, - ListSchema, - StrSchema, - IntSchema, - Int32Schema, - Int64Schema, - Float32Schema, - Float64Schema, - NumberSchema, - DateSchema, - DateTimeSchema, - DecimalSchema, - BoolSchema, - BinarySchema, - NoneSchema, - none_type, - Configuration, - Unset, - unset, - ComposedBase, - ListBase, - DictBase, - NoneBase, - StrBase, - IntBase, - Int32Base, - Int64Base, - Float32Base, - Float64Base, - NumberBase, - DateBase, - DateTimeBase, - BoolBase, - BinaryBase, - Schema, - _SchemaValidator, - _SchemaTypeChecker, - _SchemaEnumMaker -) - -from petstore_api.model.client import Client - -# body param -SchemaForRequestBodyApplicationJson = Client - - -request_body_client = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_path = '/fake_classname_test' -_method = 'PATCH' -_auth = [ - 'api_key_query', -] -SchemaFor200ResponseBodyApplicationJson = Client - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: Unset = unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class Classname(api_client.Api): - - def classname( - self: api_client.Api, - body: typing.Union[SchemaForRequestBodyApplicationJson], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization - ]: - """ - To test class name in snake case - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_client.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=_path, - method=_method, - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api_endpoints/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api_endpoints/__init__.py new file mode 100644 index 000000000000..71e83ec44559 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api_endpoints/__init__.py @@ -0,0 +1,3 @@ +# do not import all endpoints into this module because that uses a lot of memory and stack frames +# if you need the ability to import all endpoints from this module, import them with +# from petstore_api.api.pet_api import PetApi diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/store_api_endpoints/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/store_api_endpoints/__init__.py new file mode 100644 index 000000000000..30de2b107cbd --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/store_api_endpoints/__init__.py @@ -0,0 +1,3 @@ +# do not import all endpoints into this module because that uses a lot of memory and stack frames +# if you need the ability to import all endpoints from this module, import them with +# from petstore_api.api.store_api import StoreApi diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/user_api_endpoints/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/user_api_endpoints/__init__.py new file mode 100644 index 000000000000..8dced02b7662 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/user_api_endpoints/__init__.py @@ -0,0 +1,3 @@ +# do not import all endpoints into this module because that uses a lot of memory and stack frames +# if you need the ability to import all endpoints from this module, import them with +# from petstore_api.api.user_api import UserApi diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/apis/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/apis/__init__.py index 6b58c42daa6f..58c23b81b48a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/apis/__init__.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/apis/__init__.py @@ -7,7 +7,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from .api.another_fake_api import AnotherFakeApi +# from petstore_api.api.another_fake_api import AnotherFakeApi # # or import this package, but before doing it, use: # diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py deleted file mode 100644 index 63c46155bd68..000000000000 --- a/samples/openapi3/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding: utf-8 - -""" - 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: \" \\ # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - -import unittest - -import petstore_api -from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api # noqa: E501 - - -class TestFakeClassnameTags123Api(unittest.TestCase): - """FakeClassnameTags123Api unit test stubs""" - - def setUp(self): - self.api = FakeClassnameTags123Api() # noqa: E501 - - def tearDown(self): - pass - - def test_classname(self): - """Test case for classname - - To test class name in snake case # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python/petstore_api/apis/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/apis/__init__.py index 2fec461eafed..381ad9572b17 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/apis/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/apis/__init__.py @@ -6,7 +6,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from .api.another_fake_api import AnotherFakeApi +# from petstore_api.api.another_fake_api import AnotherFakeApi # # or import this package, but before doing it, use: # diff --git a/samples/openapi3/client/petstore/spring-cloud-async/pom.xml b/samples/openapi3/client/petstore/spring-cloud-async/pom.xml index f8f80fdeb1c0..d58ba6fe8582 100644 --- a/samples/openapi3/client/petstore/spring-cloud-async/pom.xml +++ b/samples/openapi3/client/petstore/spring-cloud-async/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 diff --git a/samples/openapi3/client/petstore/spring-cloud-date-time/pom.xml b/samples/openapi3/client/petstore/spring-cloud-date-time/pom.xml index 4042fc70ff17..6ec95e2589dd 100644 --- a/samples/openapi3/client/petstore/spring-cloud-date-time/pom.xml +++ b/samples/openapi3/client/petstore/spring-cloud-date-time/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/pom.xml b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/pom.xml index a28571d1b984..dfb83acaba0f 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/pom.xml +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 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 375c8ce6e448..7208cedbd0b5 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 @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { 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 7e195225a7e0..0e7e1b097362 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 @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { 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 2201d26277a1..155bff326518 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 @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/client/petstore/spring-cloud-spring-pageable/pom.xml b/samples/openapi3/client/petstore/spring-cloud-spring-pageable/pom.xml index 845510ef891b..575d665b4717 100644 --- a/samples/openapi3/client/petstore/spring-cloud-spring-pageable/pom.xml +++ b/samples/openapi3/client/petstore/spring-cloud-spring-pageable/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 diff --git a/samples/openapi3/client/petstore/spring-cloud/pom.xml b/samples/openapi3/client/petstore/spring-cloud/pom.xml index a28571d1b984..dfb83acaba0f 100644 --- a/samples/openapi3/client/petstore/spring-cloud/pom.xml +++ b/samples/openapi3/client/petstore/spring-cloud/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 diff --git a/samples/openapi3/client/petstore/spring-stubs-skip-default-interface/pom.xml b/samples/openapi3/client/petstore/spring-stubs-skip-default-interface/pom.xml index 3a5b78c1dd7f..2b2c9751ddc5 100644 --- a/samples/openapi3/client/petstore/spring-stubs-skip-default-interface/pom.xml +++ b/samples/openapi3/client/petstore/spring-stubs-skip-default-interface/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 4.8.1 diff --git a/samples/openapi3/client/petstore/spring-stubs/pom.xml b/samples/openapi3/client/petstore/spring-stubs/pom.xml index 3a5b78c1dd7f..2b2c9751ddc5 100644 --- a/samples/openapi3/client/petstore/spring-stubs/pom.xml +++ b/samples/openapi3/client/petstore/spring-stubs/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 4.8.1 diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/.gitignore b/samples/openapi3/client/petstore/typescript/builds/browser/.gitignore new file mode 100644 index 000000000000..1521c8b7652b --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/.gitignore @@ -0,0 +1 @@ +dist diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/.openapi-generator-ignore b/samples/openapi3/client/petstore/typescript/builds/browser/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/.openapi-generator/FILES b/samples/openapi3/client/petstore/typescript/builds/browser/.openapi-generator/FILES new file mode 100644 index 000000000000..4137d52d1cdf --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/.openapi-generator/FILES @@ -0,0 +1,33 @@ +.gitignore +PetApi.md +README.md +StoreApi.md +UserApi.md +apis/PetApi.ts +apis/StoreApi.ts +apis/UserApi.ts +apis/baseapi.ts +apis/exception.ts +auth/auth.ts +configuration.ts +git_push.sh +http/http.ts +http/isomorphic-fetch.ts +index.ts +middleware.ts +models/ApiResponse.ts +models/Category.ts +models/ObjectSerializer.ts +models/Order.ts +models/Pet.ts +models/Tag.ts +models/User.ts +models/all.ts +package.json +rxjsStub.ts +servers.ts +tsconfig.json +types/ObjectParamAPI.ts +types/ObservableAPI.ts +types/PromiseAPI.ts +util.ts diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/.openapi-generator/VERSION b/samples/openapi3/client/petstore/typescript/builds/browser/.openapi-generator/VERSION new file mode 100644 index 000000000000..5f68295fc196 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/PetApi.md b/samples/openapi3/client/petstore/typescript/builds/browser/PetApi.md new file mode 100644 index 000000000000..2aac946907bb --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/PetApi.md @@ -0,0 +1,510 @@ +# petstore.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) + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiAddPetRequest = { + // Pet | Pet object that needs to be added to the store + pet: { + id: 1, + category: { + id: 1, + name: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA", + }, + name: "doggie", + photoUrls: [ + "photoUrls_example", + ], + tags: [ + { + id: 1, + name: "name_example", + }, + ], + status: "available", + }, +}; + +apiInstance.addPet(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | **Pet**| Pet object that needs to be added to the store | + + +### Return type + +**Pet** + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **deletePet** +> deletePet() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiDeletePetRequest = { + // number | Pet id to delete + petId: 1, + // string (optional) + apiKey: "api_key_example", +}; + +apiInstance.deletePet(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | [**number**] | Pet id to delete | defaults to undefined + **apiKey** | [**string**] | | (optional) defaults to undefined + + +### Return type + +void (empty response body) + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **findPetsByStatus** +> Array findPetsByStatus() + +Multiple status values can be provided with comma separated strings + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiFindPetsByStatusRequest = { + // Array<'available' | 'pending' | 'sold'> | Status values that need to be considered for filter + status: [ + "available", + ], +}; + +apiInstance.findPetsByStatus(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **Array<'available' | 'pending' | 'sold'>** | Status values that need to be considered for filter | defaults to undefined + + +### Return type + +**Array** + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **findPetsByTags** +> Array findPetsByTags() + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiFindPetsByTagsRequest = { + // Array | Tags to filter by + tags: [ + "tags_example", + ], +}; + +apiInstance.findPetsByTags(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | **Array<string>** | Tags to filter by | defaults to undefined + + +### Return type + +**Array** + +### 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 tag value | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getPetById** +> Pet getPetById() + +Returns a single pet + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiGetPetByIdRequest = { + // number | ID of pet to return + petId: 1, +}; + +apiInstance.getPetById(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | [**number**] | ID of pet to return | defaults to undefined + + +### Return type + +**Pet** + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **updatePet** +> Pet updatePet(pet) + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiUpdatePetRequest = { + // Pet | Pet object that needs to be added to the store + pet: { + id: 1, + category: { + id: 1, + name: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA", + }, + name: "doggie", + photoUrls: [ + "photoUrls_example", + ], + tags: [ + { + id: 1, + name: "name_example", + }, + ], + status: "available", + }, +}; + +apiInstance.updatePet(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | **Pet**| Pet object that needs to be added to the store | + + +### Return type + +**Pet** + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **updatePetWithForm** +> updatePetWithForm() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiUpdatePetWithFormRequest = { + // number | ID of pet that needs to be updated + petId: 1, + // string | Updated name of the pet (optional) + name: "name_example", + // string | Updated status of the pet (optional) + status: "status_example", +}; + +apiInstance.updatePetWithForm(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | [**number**] | ID of pet that needs to be updated | defaults to undefined + **name** | [**string**] | Updated name of the pet | (optional) defaults to undefined + **status** | [**string**] | Updated status of the pet | (optional) defaults to undefined + + +### Return type + +void (empty response body) + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **uploadFile** +> ApiResponse uploadFile() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiUploadFileRequest = { + // number | ID of pet to update + petId: 1, + // string | Additional data to pass to server (optional) + additionalMetadata: "additionalMetadata_example", + // HttpFile | file to upload (optional) + file: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' }, +}; + +apiInstance.uploadFile(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | [**number**] | ID of pet to update | defaults to undefined + **additionalMetadata** | [**string**] | Additional data to pass to server | (optional) defaults to undefined + **file** | [**HttpFile**] | file to upload | (optional) defaults to undefined + + +### Return type + +**ApiResponse** + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/README.md b/samples/openapi3/client/petstore/typescript/builds/browser/README.md new file mode 100644 index 000000000000..24e614547f62 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/README.md @@ -0,0 +1,30 @@ +## ts-petstore-client@1.0.0 + +This generator creates TypeScript/JavaScript client that utilizes fetch-api. + +### Building + +To build and compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### Publishing + +First build the package then run ```npm publish``` + +### Consuming + +navigate to the folder of your consuming project and run one of the following commands. + +_published:_ + +``` +npm install ts-petstore-client@1.0.0 --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/StoreApi.md b/samples/openapi3/client/petstore/typescript/builds/browser/StoreApi.md new file mode 100644 index 000000000000..9dfad28caff6 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/StoreApi.md @@ -0,0 +1,234 @@ +# petstore.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** +> deleteOrder() + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.StoreApi(configuration); + +let body:petstore.StoreApiDeleteOrderRequest = { + // string | ID of the order that needs to be deleted + orderId: "orderId_example", +}; + +apiInstance.deleteOrder(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | [**string**] | ID of the order that needs to be deleted | defaults to undefined + + +### Return type + +void (empty response body) + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getInventory** +> { [key: string]: number; } getInventory() + +Returns a map of status codes to quantities + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.StoreApi(configuration); + +let body:any = {}; + +apiInstance.getInventory(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters +This endpoint does not need any parameter. + + +### Return type + +**{ [key: string]: number; }** + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getOrderById** +> Order getOrderById() + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.StoreApi(configuration); + +let body:petstore.StoreApiGetOrderByIdRequest = { + // number | ID of pet that needs to be fetched + orderId: 1, +}; + +apiInstance.getOrderById(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | [**number**] | ID of pet that needs to be fetched | defaults to undefined + + +### Return type + +**Order** + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **placeOrder** +> Order placeOrder(order) + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.StoreApi(configuration); + +let body:petstore.StoreApiPlaceOrderRequest = { + // Order | order placed for purchasing the pet + order: { + id: 1, + petId: 1, + quantity: 1, + shipDate: new Date('1970-01-01T00:00:00.00Z'), + status: "placed", + complete: false, + }, +}; + +apiInstance.placeOrder(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | **Order**| order placed for purchasing the pet | + + +### Return type + +**Order** + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/UserApi.md b/samples/openapi3/client/petstore/typescript/builds/browser/UserApi.md new file mode 100644 index 000000000000..c18f5d948960 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/UserApi.md @@ -0,0 +1,494 @@ +# petstore.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** +> createUser(user) + +This can only be done by the logged in user. + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiCreateUserRequest = { + // User | Created user object + user: { + id: 1, + username: "username_example", + firstName: "firstName_example", + lastName: "lastName_example", + email: "email_example", + password: "password_example", + phone: "phone_example", + userStatus: 1, + }, +}; + +apiInstance.createUser(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **User**| Created user object | + + +### Return type + +void (empty response body) + +### 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 | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiCreateUsersWithArrayInputRequest = { + // Array | List of user object + user: [ + { + id: 1, + username: "username_example", + firstName: "firstName_example", + lastName: "lastName_example", + email: "email_example", + password: "password_example", + phone: "phone_example", + userStatus: 1, + }, + ], +}; + +apiInstance.createUsersWithArrayInput(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **Array**| List of user object | + + +### Return type + +void (empty response body) + +### 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 | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **createUsersWithListInput** +> createUsersWithListInput(user) + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiCreateUsersWithListInputRequest = { + // Array | List of user object + user: [ + { + id: 1, + username: "username_example", + firstName: "firstName_example", + lastName: "lastName_example", + email: "email_example", + password: "password_example", + phone: "phone_example", + userStatus: 1, + }, + ], +}; + +apiInstance.createUsersWithListInput(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **Array**| List of user object | + + +### Return type + +void (empty response body) + +### 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 | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **deleteUser** +> deleteUser() + +This can only be done by the logged in user. + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiDeleteUserRequest = { + // string | The name that needs to be deleted + username: "username_example", +}; + +apiInstance.deleteUser(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | [**string**] | The name that needs to be deleted | defaults to undefined + + +### Return type + +void (empty response body) + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getUserByName** +> User getUserByName() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiGetUserByNameRequest = { + // string | The name that needs to be fetched. Use user1 for testing. + username: "username_example", +}; + +apiInstance.getUserByName(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | [**string**] | The name that needs to be fetched. Use user1 for testing. | defaults to undefined + + +### Return type + +**User** + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **loginUser** +> string loginUser() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiLoginUserRequest = { + // string | The user name for login + username: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA", + // string | The password for login in clear text + password: "password_example", +}; + +apiInstance.loginUser(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | [**string**] | The user name for login | defaults to undefined + **password** | [**string**] | The password for login in clear text | defaults to undefined + + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **logoutUser** +> logoutUser() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:any = {}; + +apiInstance.logoutUser(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters +This endpoint does not need any parameter. + + +### Return type + +void (empty response body) + +### 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 | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **updateUser** +> updateUser(user) + +This can only be done by the logged in user. + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiUpdateUserRequest = { + // string | name that need to be deleted + username: "username_example", + // User | Updated user object + user: { + id: 1, + username: "username_example", + firstName: "firstName_example", + lastName: "lastName_example", + email: "email_example", + password: "password_example", + phone: "phone_example", + userStatus: 1, + }, +}; + +apiInstance.updateUser(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **User**| Updated user object | + **username** | [**string**] | name that need to be deleted | defaults to undefined + + +### Return type + +void (empty response body) + +### 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 | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/browser/apis/PetApi.ts new file mode 100644 index 000000000000..273352e4f6d9 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/apis/PetApi.ts @@ -0,0 +1,672 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { ApiResponse } from '../models/ApiResponse'; +import { Pet } from '../models/Pet'; + +/** + * no description + */ +export class PetApiRequestFactory extends BaseAPIRequestFactory { + + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public async addPet(pet: Pet, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new RequiredError("PetApi", "addPet", "pet"); + } + + + // Path Params + const localVarPath = '/pet'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + + "application/xml" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(pet, "Pet", ""), + contentType + ); + requestContext.setBody(serializedBody); + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public async deletePet(petId: number, apiKey?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError("PetApi", "deletePet", "petId"); + } + + + + // Path Params + const localVarPath = '/pet/{petId}' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Header Params + requestContext.setHeaderParam("api_key", ObjectSerializer.serialize(apiKey, "string", "")); + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public async findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new RequiredError("PetApi", "findPetsByStatus", "status"); + } + + + // Path Params + const localVarPath = '/pet/findByStatus'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (status !== undefined) { + requestContext.setQueryParam("status", ObjectSerializer.serialize(status, "Array<'available' | 'pending' | 'sold'>", "")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public async findPetsByTags(tags: Array, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new RequiredError("PetApi", "findPetsByTags", "tags"); + } + + + // Path Params + const localVarPath = '/pet/findByTags'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (tags !== undefined) { + requestContext.setQueryParam("tags", ObjectSerializer.serialize(tags, "Array", "")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public async getPetById(petId: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError("PetApi", "getPetById", "petId"); + } + + + // Path Params + const localVarPath = '/pet/{petId}' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["api_key"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public async updatePet(pet: Pet, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new RequiredError("PetApi", "updatePet", "pet"); + } + + + // Path Params + const localVarPath = '/pet'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + + "application/xml" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(pet, "Pet", ""), + contentType + ); + requestContext.setBody(serializedBody); + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Updates a pet in the store with form data + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + */ + public async updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError("PetApi", "updatePetWithForm", "petId"); + } + + + + + // Path Params + const localVarPath = '/pet/{petId}' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Form Params + const useForm = canConsumeForm([ + 'application/x-www-form-urlencoded', + ]); + + let localVarFormParams + if (useForm) { + localVarFormParams = new FormData(); + } else { + localVarFormParams = new URLSearchParams(); + } + + if (name !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('name', name as any); + } + if (status !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('status', status as any); + } + + requestContext.setBody(localVarFormParams); + + if(!useForm) { + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/x-www-form-urlencoded" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + } + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public async uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError("PetApi", "uploadFile", "petId"); + } + + + + + // Path Params + const localVarPath = '/pet/{petId}/uploadImage' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Form Params + const useForm = canConsumeForm([ + 'multipart/form-data', + ]); + + let localVarFormParams + if (useForm) { + localVarFormParams = new FormData(); + } else { + localVarFormParams = new URLSearchParams(); + } + + if (additionalMetadata !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('additionalMetadata', additionalMetadata as any); + } + if (file !== undefined) { + // TODO: replace .append with .set + if (localVarFormParams instanceof FormData) { + localVarFormParams.append('file', file, file.name); + } + } + + requestContext.setBody(localVarFormParams); + + if(!useForm) { + const contentType = ObjectSerializer.getPreferredMediaType([ + "multipart/form-data" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + } + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class PetApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to addPet + * @throws ApiException if the response code was not in [200, 299] + */ + public async addPet(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Pet = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Pet", "" + ) as Pet; + return body; + } + if (isCodeInRange("405", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Pet = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Pet", "" + ) as Pet; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deletePet + * @throws ApiException if the response code was not in [200, 299] + */ + public async deletePet(response: ResponseContext): Promise< void> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid pet value", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to findPetsByStatus + * @throws ApiException if the response code was not in [200, 299] + */ + public async findPetsByStatus(response: ResponseContext): Promise > { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Array = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Array", "" + ) as Array; + return body; + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid status value", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Array = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Array", "" + ) as Array; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to findPetsByTags + * @throws ApiException if the response code was not in [200, 299] + */ + public async findPetsByTags(response: ResponseContext): Promise > { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Array = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Array", "" + ) as Array; + return body; + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid tag value", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Array = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Array", "" + ) as Array; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getPetById + * @throws ApiException if the response code was not in [200, 299] + */ + public async getPetById(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Pet = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Pet", "" + ) as Pet; + return body; + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Pet not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Pet = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Pet", "" + ) as Pet; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updatePet + * @throws ApiException if the response code was not in [200, 299] + */ + public async updatePet(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Pet = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Pet", "" + ) as Pet; + return body; + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Pet not found", undefined, response.headers); + } + if (isCodeInRange("405", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Validation exception", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Pet = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Pet", "" + ) as Pet; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updatePetWithForm + * @throws ApiException if the response code was not in [200, 299] + */ + public async updatePetWithForm(response: ResponseContext): Promise< void> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("405", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to uploadFile + * @throws ApiException if the response code was not in [200, 299] + */ + public async uploadFile(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ApiResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ApiResponse", "" + ) as ApiResponse; + return body; + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ApiResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ApiResponse", "" + ) as ApiResponse; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/browser/apis/StoreApi.ts new file mode 100644 index 000000000000..1eead2922748 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/apis/StoreApi.ts @@ -0,0 +1,278 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { Order } from '../models/Order'; + +/** + * no description + */ +export class StoreApiRequestFactory extends BaseAPIRequestFactory { + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public async deleteOrder(orderId: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError("StoreApi", "deleteOrder", "orderId"); + } + + + // Path Params + const localVarPath = '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public async getInventory(_options?: Configuration): Promise { + let _config = _options || this.configuration; + + // Path Params + const localVarPath = '/store/inventory'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["api_key"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public async getOrderById(orderId: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError("StoreApi", "getOrderById", "orderId"); + } + + + // Path Params + const localVarPath = '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public async placeOrder(order: Order, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'order' is not null or undefined + if (order === null || order === undefined) { + throw new RequiredError("StoreApi", "placeOrder", "order"); + } + + + // Path Params + const localVarPath = '/store/order'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(order, "Order", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class StoreApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteOrder + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteOrder(response: ResponseContext): Promise< void> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Order not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getInventory + * @throws ApiException if the response code was not in [200, 299] + */ + public async getInventory(response: ResponseContext): Promise<{ [key: string]: number; } > { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: { [key: string]: number; } = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "{ [key: string]: number; }", "int32" + ) as { [key: string]: number; }; + return body; + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: { [key: string]: number; } = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "{ [key: string]: number; }", "int32" + ) as { [key: string]: number; }; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getOrderById + * @throws ApiException if the response code was not in [200, 299] + */ + public async getOrderById(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Order = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Order", "" + ) as Order; + return body; + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Order not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Order = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Order", "" + ) as Order; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to placeOrder + * @throws ApiException if the response code was not in [200, 299] + */ + public async placeOrder(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Order = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Order", "" + ) as Order; + return body; + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid Order", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Order = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Order", "" + ) as Order; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/browser/apis/UserApi.ts new file mode 100644 index 000000000000..9784393c7a40 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/apis/UserApi.ts @@ -0,0 +1,569 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { User } from '../models/User'; + +/** + * no description + */ +export class UserApiRequestFactory extends BaseAPIRequestFactory { + + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public async createUser(user: User, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError("UserApi", "createUser", "user"); + } + + + // Path Params + const localVarPath = '/user'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(user, "User", ""), + contentType + ); + requestContext.setBody(serializedBody); + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["api_key"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public async createUsersWithArrayInput(user: Array, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError("UserApi", "createUsersWithArrayInput", "user"); + } + + + // Path Params + const localVarPath = '/user/createWithArray'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(user, "Array", ""), + contentType + ); + requestContext.setBody(serializedBody); + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["api_key"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public async createUsersWithListInput(user: Array, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError("UserApi", "createUsersWithListInput", "user"); + } + + + // Path Params + const localVarPath = '/user/createWithList'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(user, "Array", ""), + contentType + ); + requestContext.setBody(serializedBody); + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["api_key"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public async deleteUser(username: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError("UserApi", "deleteUser", "username"); + } + + + // Path Params + const localVarPath = '/user/{username}' + .replace('{' + 'username' + '}', encodeURIComponent(String(username))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["api_key"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public async getUserByName(username: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError("UserApi", "getUserByName", "username"); + } + + + // Path Params + const localVarPath = '/user/{username}' + .replace('{' + 'username' + '}', encodeURIComponent(String(username))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public async loginUser(username: string, password: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError("UserApi", "loginUser", "username"); + } + + + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError("UserApi", "loginUser", "password"); + } + + + // Path Params + const localVarPath = '/user/login'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (username !== undefined) { + requestContext.setQueryParam("username", ObjectSerializer.serialize(username, "string", "")); + } + + // Query Params + if (password !== undefined) { + requestContext.setQueryParam("password", ObjectSerializer.serialize(password, "string", "")); + } + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Logs out current logged in user session + */ + public async logoutUser(_options?: Configuration): Promise { + let _config = _options || this.configuration; + + // Path Params + const localVarPath = '/user/logout'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["api_key"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public async updateUser(username: string, user: User, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError("UserApi", "updateUser", "username"); + } + + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError("UserApi", "updateUser", "user"); + } + + + // Path Params + const localVarPath = '/user/{username}' + .replace('{' + 'username' + '}', encodeURIComponent(String(username))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(user, "User", ""), + contentType + ); + requestContext.setBody(serializedBody); + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["api_key"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class UserApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createUser + * @throws ApiException if the response code was not in [200, 299] + */ + public async createUser(response: ResponseContext): Promise< void> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("0", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createUsersWithArrayInput + * @throws ApiException if the response code was not in [200, 299] + */ + public async createUsersWithArrayInput(response: ResponseContext): Promise< void> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("0", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createUsersWithListInput + * @throws ApiException if the response code was not in [200, 299] + */ + public async createUsersWithListInput(response: ResponseContext): Promise< void> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("0", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteUser + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteUser(response: ResponseContext): Promise< void> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "User not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getUserByName + * @throws ApiException if the response code was not in [200, 299] + */ + public async getUserByName(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: User = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "User", "" + ) as User; + return body; + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "User not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: User = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "User", "" + ) as User; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to loginUser + * @throws ApiException if the response code was not in [200, 299] + */ + public async loginUser(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: string = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "string", "" + ) as string; + return body; + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid username/password supplied", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: string = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "string", "" + ) as string; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to logoutUser + * @throws ApiException if the response code was not in [200, 299] + */ + public async logoutUser(response: ResponseContext): Promise< void> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("0", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updateUser + * @throws ApiException if the response code was not in [200, 299] + */ + public async updateUser(response: ResponseContext): Promise< void> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid user supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "User not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/apis/baseapi.ts b/samples/openapi3/client/petstore/typescript/builds/browser/apis/baseapi.ts new file mode 100644 index 000000000000..ce1e2dbc47e1 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/apis/baseapi.ts @@ -0,0 +1,37 @@ +import { Configuration } from '../configuration' + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPIRequestFactory { + + constructor(protected configuration: Configuration) { + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public api: string, public method: string, public field: string) { + super("Required parameter " + field + " was null or undefined when calling " + api + "." + method + "."); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/apis/exception.ts b/samples/openapi3/client/petstore/typescript/builds/browser/apis/exception.ts new file mode 100644 index 000000000000..9365d33a8f7e --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/apis/exception.ts @@ -0,0 +1,15 @@ +/** + * Represents an error caused by an api call i.e. it has attributes for a HTTP status code + * and the returned body object. + * + * Example + * API returns a ErrorMessageObject whenever HTTP status code is not in [200, 299] + * => ApiException(404, someErrorMessageObject) + * + */ +export class ApiException extends Error { + public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) { + super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " + + JSON.stringify(headers)) + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/browser/auth/auth.ts new file mode 100644 index 000000000000..7c393656367d --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/auth/auth.ts @@ -0,0 +1,107 @@ +import { RequestContext } from "../http/http"; + +/** + * Interface authentication schemes. + */ +export interface SecurityAuthentication { + /* + * @return returns the name of the security authentication as specified in OAI + */ + getName(): string; + + /** + * Applies the authentication scheme to the request context + * + * @params context the request context which should use this authentication scheme + */ + applySecurityAuthentication(context: RequestContext): void | Promise; +} + +export interface TokenProvider { + getToken(): Promise | string; +} + +/** + * Applies apiKey authentication to the request context. + */ +export class ApiKeyAuthentication implements SecurityAuthentication { + /** + * Configures this api key authentication with the necessary properties + * + * @param apiKey: The api key to be used for every request + */ + public constructor(private apiKey: string) {} + + public getName(): string { + return "api_key"; + } + + public applySecurityAuthentication(context: RequestContext) { + context.setHeaderParam("api_key", this.apiKey); + } +} + +/** + * Applies oauth2 authentication to the request context. + */ +export class PetstoreAuthAuthentication implements SecurityAuthentication { + /** + * Configures OAuth2 with the necessary properties + * + * @param accessToken: The access token to be used for every request + */ + public constructor(private accessToken: string) {} + + public getName(): string { + return "petstore_auth"; + } + + public applySecurityAuthentication(context: RequestContext) { + context.setHeaderParam("Authorization", "Bearer " + this.accessToken); + } +} + + +export type AuthMethods = { + "default"?: SecurityAuthentication, + "api_key"?: SecurityAuthentication, + "petstore_auth"?: SecurityAuthentication +} + +export type ApiKeyConfiguration = string; +export type HttpBasicConfiguration = { "username": string, "password": string }; +export type HttpBearerConfiguration = { tokenProvider: TokenProvider }; +export type OAuth2Configuration = { accessToken: string }; + +export type AuthMethodsConfiguration = { + "default"?: SecurityAuthentication, + "api_key"?: ApiKeyConfiguration, + "petstore_auth"?: OAuth2Configuration +} + +/** + * Creates the authentication methods from a swagger description. + * + */ +export function configureAuthMethods(config: AuthMethodsConfiguration | undefined): AuthMethods { + let authMethods: AuthMethods = {} + + if (!config) { + return authMethods; + } + authMethods["default"] = config["default"] + + if (config["api_key"]) { + authMethods["api_key"] = new ApiKeyAuthentication( + config["api_key"] + ); + } + + if (config["petstore_auth"]) { + authMethods["petstore_auth"] = new PetstoreAuthAuthentication( + config["petstore_auth"]["accessToken"] + ); + } + + return authMethods; +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/configuration.ts b/samples/openapi3/client/petstore/typescript/builds/browser/configuration.ts new file mode 100644 index 000000000000..b78d85972a4a --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/configuration.ts @@ -0,0 +1,66 @@ +import { HttpLibrary } from "./http/http"; +import { Middleware, PromiseMiddleware, PromiseMiddlewareWrapper } from "./middleware"; +import { IsomorphicFetchHttpLibrary as DefaultHttpLibrary } from "./http/isomorphic-fetch"; +import { BaseServerConfiguration, server1 } from "./servers"; +import { configureAuthMethods, AuthMethods, AuthMethodsConfiguration } from "./auth/auth"; + +export interface Configuration { + readonly baseServer: BaseServerConfiguration; + readonly httpApi: HttpLibrary; + readonly middleware: Middleware[]; + readonly authMethods: AuthMethods; +} + + +/** + * Interface with which a configuration object can be configured. + */ +export interface ConfigurationParameters { + /** + * Default server to use + */ + baseServer?: BaseServerConfiguration; + /** + * HTTP library to use e.g. IsomorphicFetch + */ + httpApi?: HttpLibrary; + /** + * The middlewares which will be applied to requests and responses + */ + middleware?: Middleware[]; + /** + * Configures all middlewares using the promise api instead of observables (which Middleware uses) + */ + promiseMiddleware?: PromiseMiddleware[]; + /** + * Configuration for the available authentication methods + */ + authMethods?: AuthMethodsConfiguration +} + +/** + * Configuration factory function + * + * If a property is not included in conf, a default is used: + * - baseServer: server1 + * - httpApi: IsomorphicFetchHttpLibrary + * - middleware: [] + * - promiseMiddleware: [] + * - authMethods: {} + * + * @param conf partial configuration + */ +export function createConfiguration(conf: ConfigurationParameters = {}): Configuration { + const configuration: Configuration = { + baseServer: conf.baseServer !== undefined ? conf.baseServer : server1, + httpApi: conf.httpApi || new DefaultHttpLibrary(), + middleware: conf.middleware || [], + authMethods: configureAuthMethods(conf.authMethods) + }; + if (conf.promiseMiddleware) { + conf.promiseMiddleware.forEach( + m => configuration.middleware.push(new PromiseMiddlewareWrapper(m)) + ); + } + return configuration; +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/git_push.sh b/samples/openapi3/client/petstore/typescript/builds/browser/git_push.sh new file mode 100644 index 000000000000..b253029754ed --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/git_push.sh @@ -0,0 +1,51 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts new file mode 100644 index 000000000000..f8f62d6ce6f6 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts @@ -0,0 +1,234 @@ +import URLParse from "url-parse"; +import { Observable, from } from '../rxjsStub'; + +export * from './isomorphic-fetch'; + +/** + * Represents an HTTP method. + */ +export enum HttpMethod { + GET = "GET", + HEAD = "HEAD", + POST = "POST", + PUT = "PUT", + DELETE = "DELETE", + CONNECT = "CONNECT", + OPTIONS = "OPTIONS", + TRACE = "TRACE", + PATCH = "PATCH" +} + +/** + * Represents an HTTP file which will be transferred from or to a server. + */ +export type HttpFile = Blob & { readonly name: string }; + + +export class HttpException extends Error { + public constructor(msg: string) { + super(msg); + } +} + +/** + * Represents the body of an outgoing HTTP request. + */ +export type RequestBody = undefined | string | FormData | URLSearchParams; + +/** + * Represents an HTTP request context + */ +export class RequestContext { + private headers: { [key: string]: string } = {}; + private body: RequestBody = undefined; + private url: URLParse; + + /** + * Creates the request context using a http method and request resource url + * + * @param url url of the requested resource + * @param httpMethod http method + */ + public constructor(url: string, private httpMethod: HttpMethod) { + this.url = new URLParse(url, true); + } + + /* + * Returns the url set in the constructor including the query string + * + */ + public getUrl(): string { + return this.url.toString(); + } + + /** + * Replaces the url set in the constructor with this url. + * + */ + public setUrl(url: string) { + this.url = new URLParse(url, true); + } + + /** + * Sets the body of the http request either as a string or FormData + * + * Note that setting a body on a HTTP GET, HEAD, DELETE, CONNECT or TRACE + * request is discouraged. + * https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#rfc.section.7.3.1 + * + * @param body the body of the request + */ + public setBody(body: RequestBody) { + this.body = body; + } + + public getHttpMethod(): HttpMethod { + return this.httpMethod; + } + + public getHeaders(): { [key: string]: string } { + return this.headers; + } + + public getBody(): RequestBody { + return this.body; + } + + public setQueryParam(name: string, value: string) { + let queryObj = this.url.query; + queryObj[name] = value; + this.url.set("query", queryObj); + } + + /** + * Sets a cookie with the name and value. NO check for duplicate cookies is performed + * + */ + public addCookie(name: string, value: string): void { + if (!this.headers["Cookie"]) { + this.headers["Cookie"] = ""; + } + this.headers["Cookie"] += name + "=" + value + "; "; + } + + public setHeaderParam(key: string, value: string): void { + this.headers[key] = value; + } +} + +export interface ResponseBody { + text(): Promise; + binary(): Promise; +} + +/** + * Helper class to generate a `ResponseBody` from binary data + */ +export class SelfDecodingBody implements ResponseBody { + constructor(private dataSource: Promise) {} + + binary(): Promise { + return this.dataSource; + } + + async text(): Promise { + const data: Blob = await this.dataSource; + // @ts-ignore + if (data.text) { + // @ts-ignore + return data.text(); + } + + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.addEventListener("load", () => resolve(reader.result as string)); + reader.addEventListener("error", () => reject(reader.error)); + reader.readAsText(data); + }); + } +} + +export class ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: { [key: string]: string }, + public body: ResponseBody + ) {} + + /** + * Parse header value in the form `value; param1="value1"` + * + * E.g. for Content-Type or Content-Disposition + * Parameter names are converted to lower case + * The first parameter is returned with the key `""` + */ + public getParsedHeader(headerName: string): { [parameter: string]: string } { + const result: { [parameter: string]: string } = {}; + if (!this.headers[headerName]) { + return result; + } + + const parameters = this.headers[headerName].split(";"); + for (const parameter of parameters) { + let [key, value] = parameter.split("=", 2); + key = key.toLowerCase().trim(); + if (value === undefined) { + result[""] = key; + } else { + value = value.trim(); + if (value.startsWith('"') && value.endsWith('"')) { + value = value.substring(1, value.length - 1); + } + result[key] = value; + } + } + return result; + } + + public async getBodyAsFile(): Promise { + const data = await this.body.binary(); + const fileName = this.getParsedHeader("content-disposition")["filename"] || ""; + const contentType = this.headers["content-type"] || ""; + try { + return new File([data], fileName, { type: contentType }); + } catch (error) { + /** Fallback for when the File constructor is not available */ + return Object.assign(data, { + name: fileName, + type: contentType + }); + } + } + + /** + * Use a heuristic to get a body of unknown data structure. + * Return as string if possible, otherwise as binary. + */ + public getBodyAsAny(): Promise { + try { + return this.body.text(); + } catch {} + + try { + return this.body.binary(); + } catch {} + + return Promise.resolve(undefined); + } +} + +export interface HttpLibrary { + send(request: RequestContext): Observable; +} + +export interface PromiseHttpLibrary { + send(request: RequestContext): Promise; +} + +export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLibrary { + return { + send(request: RequestContext): Observable { + return from(promiseHttpLibrary.send(request)); + } + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/browser/http/isomorphic-fetch.ts new file mode 100644 index 000000000000..3af85f3d902c --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/http/isomorphic-fetch.ts @@ -0,0 +1,32 @@ +import {HttpLibrary, RequestContext, ResponseContext} from './http'; +import { from, Observable } from '../rxjsStub'; +import "whatwg-fetch"; + +export class IsomorphicFetchHttpLibrary implements HttpLibrary { + + public send(request: RequestContext): Observable { + let method = request.getHttpMethod().toString(); + let body = request.getBody(); + + const resultPromise = fetch(request.getUrl(), { + method: method, + body: body as any, + headers: request.getHeaders(), + credentials: "same-origin" + }).then((resp: any) => { + const headers: { [name: string]: string } = {}; + resp.headers.forEach((value: string, name: string) => { + headers[name] = value; + }); + + const body = { + text: () => resp.text(), + binary: () => resp.blob() + }; + return new ResponseContext(resp.status, headers, body); + }); + + return from>(resultPromise); + + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/index.ts b/samples/openapi3/client/petstore/typescript/builds/browser/index.ts new file mode 100644 index 000000000000..61ec7fec0cec --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/index.ts @@ -0,0 +1,12 @@ +export * from "./http/http"; +export * from "./auth/auth"; +export * from "./models/all"; +export { createConfiguration } from "./configuration" +export { Configuration } from "./configuration" +export * from "./apis/exception"; +export * from "./servers"; +export { RequiredError } from "./apis/baseapi"; + +export { PromiseMiddleware as Middleware } from './middleware'; +export { PromisePetApi as PetApi, PromiseStoreApi as StoreApi, PromiseUserApi as UserApi } from './types/PromiseAPI'; + diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/middleware.ts b/samples/openapi3/client/petstore/typescript/builds/browser/middleware.ts new file mode 100644 index 000000000000..524f93f016b2 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/middleware.ts @@ -0,0 +1,66 @@ +import {RequestContext, ResponseContext} from './http/http'; +import { Observable, from } from './rxjsStub'; + +/** + * Defines the contract for a middleware intercepting requests before + * they are sent (but after the RequestContext was created) + * and before the ResponseContext is unwrapped. + * + */ +export interface Middleware { + /** + * Modifies the request before the request is sent. + * + * @param context RequestContext of a request which is about to be sent to the server + * @returns an observable of the updated request context + * + */ + pre(context: RequestContext): Observable; + /** + * Modifies the returned response before it is deserialized. + * + * @param context ResponseContext of a sent request + * @returns an observable of the modified response context + */ + post(context: ResponseContext): Observable; +} + +export class PromiseMiddlewareWrapper implements Middleware { + + public constructor(private middleware: PromiseMiddleware) { + + } + + pre(context: RequestContext): Observable { + return from(this.middleware.pre(context)); + } + + post(context: ResponseContext): Observable { + return from(this.middleware.post(context)); + } + +} + +/** + * Defines the contract for a middleware intercepting requests before + * they are sent (but after the RequestContext was created) + * and before the ResponseContext is unwrapped. + * + */ +export interface PromiseMiddleware { + /** + * Modifies the request before the request is sent. + * + * @param context RequestContext of a request which is about to be sent to the server + * @returns an observable of the updated request context + * + */ + pre(context: RequestContext): Promise; + /** + * Modifies the returned response before it is deserialized. + * + * @param context ResponseContext of a sent request + * @returns an observable of the modified response context + */ + post(context: ResponseContext): Promise; +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/ApiResponse.ts new file mode 100644 index 000000000000..f4b2d010fb71 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/ApiResponse.ts @@ -0,0 +1,52 @@ +/** + * 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. + * + * OpenAPI spec version: 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 { HttpFile } from '../http/http'; + +/** +* Describes the result of uploading an image resource +*/ +export class ApiResponse { + 'code'?: number; + 'type'?: string; + 'message'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "number", + "format": "int32" + }, + { + "name": "type", + "baseName": "type", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ApiResponse.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/Category.ts new file mode 100644 index 000000000000..5d63fc87a998 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/Category.ts @@ -0,0 +1,45 @@ +/** + * 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. + * + * OpenAPI spec version: 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 { HttpFile } from '../http/http'; + +/** +* A category for a pet +*/ +export class Category { + 'id'?: number; + 'name'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Category.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/ObjectSerializer.ts new file mode 100644 index 000000000000..2fb0962a2520 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/ObjectSerializer.ts @@ -0,0 +1,238 @@ +export * from './ApiResponse'; +export * from './Category'; +export * from './Order'; +export * from './Pet'; +export * from './Tag'; +export * from './User'; + +import { ApiResponse } from './ApiResponse'; +import { Category } from './Category'; +import { Order , OrderStatusEnum } from './Order'; +import { Pet , PetStatusEnum } from './Pet'; +import { Tag } from './Tag'; +import { User } from './User'; + +/* tslint:disable:no-unused-variable */ +let primitives = [ + "string", + "boolean", + "double", + "integer", + "long", + "float", + "number", + "any" + ]; + +const supportedMediaTypes: { [mediaType: string]: number } = { + "application/json": Infinity, + "application/octet-stream": 0, + "application/x-www-form-urlencoded": 0 +} + + +let enumsMap: Set = new Set([ + "OrderStatusEnum", + "PetStatusEnum", +]); + +let typeMap: {[index: string]: any} = { + "ApiResponse": ApiResponse, + "Category": Category, + "Order": Order, + "Pet": Pet, + "Tag": Tag, + "User": User, +} + +export class ObjectSerializer { + public static findCorrectType(data: any, expectedType: string) { + if (data == undefined) { + return expectedType; + } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { + return expectedType; + } else if (expectedType === "Date") { + return expectedType; + } else { + if (enumsMap.has(expectedType)) { + return expectedType; + } + + if (!typeMap[expectedType]) { + return expectedType; // w/e we don't know the type + } + + // Check the discriminator + let discriminatorProperty = typeMap[expectedType].discriminator; + if (discriminatorProperty == null) { + return expectedType; // the type does not have a discriminator. use it. + } else { + if (data[discriminatorProperty]) { + var discriminatorType = data[discriminatorProperty]; + if(typeMap[discriminatorType]){ + return discriminatorType; // use the type given in the discriminator + } else { + return expectedType; // discriminator did not map to a type + } + } else { + return expectedType; // discriminator was not present (or an empty string) + } + } + } + } + + public static serialize(data: any, type: string, format: string) { + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.serialize(date, subType, format)); + } + return transformedData; + } else if (type === "Date") { + if (format == "date") { + let month = data.getMonth()+1 + month = month < 10 ? "0" + month.toString() : month.toString() + let day = data.getDate(); + day = day < 10 ? "0" + day.toString() : day.toString(); + + return data.getFullYear() + "-" + month + "-" + day; + } else { + return data.toISOString(); + } + } else { + if (enumsMap.has(type)) { + return data; + } + if (!typeMap[type]) { // in case we dont know the type + return data; + } + + // Get the actual type of this object + type = this.findCorrectType(data, type); + + // get the map for the correct type. + let attributeTypes = typeMap[type].getAttributeTypeMap(); + let instance: {[index: string]: any} = {}; + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + } + return instance; + } + } + + public static deserialize(data: any, type: string, format: string) { + // polymorphism may change the actual type. + type = ObjectSerializer.findCorrectType(data, type); + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.deserialize(date, subType, format)); + } + return transformedData; + } else if (type === "Date") { + return new Date(data); + } else { + if (enumsMap.has(type)) {// is Enum + return data; + } + + if (!typeMap[type]) { // dont know the type + return data; + } + let instance = new typeMap[type](); + let attributeTypes = typeMap[type].getAttributeTypeMap(); + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); + if (value !== undefined) { + instance[attributeType.name] = value; + } + } + return instance; + } + } + + + /** + * Normalize media type + * + * We currently do not handle any media types attributes, i.e. anything + * after a semicolon. All content is assumed to be UTF-8 compatible. + */ + public static normalizeMediaType(mediaType: string | undefined): string | undefined { + if (mediaType === undefined) { + return undefined; + } + return mediaType.split(";")[0].trim().toLowerCase(); + } + + /** + * From a list of possible media types, choose the one we can handle best. + * + * The order of the given media types does not have any impact on the choice + * made. + */ + public static getPreferredMediaType(mediaTypes: Array): string { + /** According to OAS 3 we should default to json */ + if (!mediaTypes) { + return "application/json"; + } + + const normalMediaTypes = mediaTypes.map(this.normalizeMediaType); + let selectedMediaType: string | undefined = undefined; + let selectedRank: number = -Infinity; + for (const mediaType of normalMediaTypes) { + if (supportedMediaTypes[mediaType!] > selectedRank) { + selectedMediaType = mediaType; + selectedRank = supportedMediaTypes[mediaType!]; + } + } + + if (selectedMediaType === undefined) { + throw new Error("None of the given media types are supported: " + mediaTypes.join(", ")); + } + + return selectedMediaType!; + } + + /** + * Convert data to a string according the given media type + */ + public static stringify(data: any, mediaType: string): string { + if (mediaType === "application/json") { + return JSON.stringify(data); + } + + throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.stringify."); + } + + /** + * Parse data from a string according to the given media type + */ + public static parse(rawData: string, mediaType: string | undefined) { + if (mediaType === undefined) { + throw new Error("Cannot parse content. No Content-Type defined."); + } + + if (mediaType === "application/json") { + return JSON.parse(rawData); + } + + throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse."); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/Order.ts new file mode 100644 index 000000000000..a2f84555ff1e --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/Order.ts @@ -0,0 +1,79 @@ +/** + * 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. + * + * OpenAPI spec version: 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 { HttpFile } from '../http/http'; + +/** +* An order for a pets from the pet store +*/ +export class Order { + 'id'?: number; + 'petId'?: number; + 'quantity'?: number; + 'shipDate'?: Date; + /** + * Order Status + */ + 'status'?: OrderStatusEnum; + 'complete'?: boolean; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "petId", + "baseName": "petId", + "type": "number", + "format": "int64" + }, + { + "name": "quantity", + "baseName": "quantity", + "type": "number", + "format": "int32" + }, + { + "name": "shipDate", + "baseName": "shipDate", + "type": "Date", + "format": "date-time" + }, + { + "name": "status", + "baseName": "status", + "type": "OrderStatusEnum", + "format": "" + }, + { + "name": "complete", + "baseName": "complete", + "type": "boolean", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Order.attributeTypeMap; + } + + public constructor() { + } +} + + +export type OrderStatusEnum = "placed" | "approved" | "delivered" ; + diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/Pet.ts new file mode 100644 index 000000000000..6b191ad8d707 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/Pet.ts @@ -0,0 +1,81 @@ +/** + * 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. + * + * OpenAPI spec version: 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 { Category } from './Category'; +import { Tag } from './Tag'; +import { HttpFile } from '../http/http'; + +/** +* A pet for sale in the pet store +*/ +export class Pet { + 'id'?: number; + 'category'?: Category; + 'name': string; + 'photoUrls': Array; + 'tags'?: Array; + /** + * pet status in the store + */ + 'status'?: PetStatusEnum; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "category", + "baseName": "category", + "type": "Category", + "format": "" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "photoUrls", + "baseName": "photoUrls", + "type": "Array", + "format": "" + }, + { + "name": "tags", + "baseName": "tags", + "type": "Array", + "format": "" + }, + { + "name": "status", + "baseName": "status", + "type": "PetStatusEnum", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Pet.attributeTypeMap; + } + + public constructor() { + } +} + + +export type PetStatusEnum = "available" | "pending" | "sold" ; + diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/Tag.ts new file mode 100644 index 000000000000..8c4f6967b9a1 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/Tag.ts @@ -0,0 +1,45 @@ +/** + * 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. + * + * OpenAPI spec version: 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 { HttpFile } from '../http/http'; + +/** +* A tag for a pet +*/ +export class Tag { + 'id'?: number; + 'name'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Tag.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/User.ts new file mode 100644 index 000000000000..68528ad3c9e0 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/User.ts @@ -0,0 +1,90 @@ +/** + * 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. + * + * OpenAPI spec version: 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 { HttpFile } from '../http/http'; + +/** +* A User who is purchasing from the pet store +*/ +export class User { + 'id'?: number; + 'username'?: string; + 'firstName'?: string; + 'lastName'?: string; + 'email'?: string; + 'password'?: string; + 'phone'?: string; + /** + * User Status + */ + 'userStatus'?: number; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "username", + "baseName": "username", + "type": "string", + "format": "" + }, + { + "name": "firstName", + "baseName": "firstName", + "type": "string", + "format": "" + }, + { + "name": "lastName", + "baseName": "lastName", + "type": "string", + "format": "" + }, + { + "name": "email", + "baseName": "email", + "type": "string", + "format": "" + }, + { + "name": "password", + "baseName": "password", + "type": "string", + "format": "" + }, + { + "name": "phone", + "baseName": "phone", + "type": "string", + "format": "" + }, + { + "name": "userStatus", + "baseName": "userStatus", + "type": "number", + "format": "int32" + } ]; + + static getAttributeTypeMap() { + return User.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/all.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/all.ts new file mode 100644 index 000000000000..2edba7f0bd56 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/all.ts @@ -0,0 +1,6 @@ +export * from './ApiResponse' +export * from './Category' +export * from './Order' +export * from './Pet' +export * from './Tag' +export * from './User' diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/package-lock.json b/samples/openapi3/client/petstore/typescript/builds/browser/package-lock.json new file mode 100644 index 000000000000..8bec76149b2f --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/package-lock.json @@ -0,0 +1,113 @@ +{ + "name": "ts-petstore-client", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "ts-petstore-client", + "version": "1.0.0", + "license": "Unlicense", + "dependencies": { + "es6-promise": "^4.2.4", + "url-parse": "^1.4.3", + "whatwg-fetch": "^3.0.0" + }, + "devDependencies": { + "@types/url-parse": "1.4.4", + "typescript": "^3.9.3" + } + }, + "node_modules/@types/url-parse": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@types/url-parse/-/url-parse-1.4.4.tgz", + "integrity": "sha512-KtQLad12+4T/NfSxpoDhmr22+fig3T7/08QCgmutYA6QSznSRmEtuL95GrhVV40/0otTEdFc+etRcCTqhh1q5Q==", + "dev": true + }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" + }, + "node_modules/typescript": { + "version": "3.9.10", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", + "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/url-parse": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.4.tgz", + "integrity": "sha512-ITeAByWWoqutFClc/lRZnFplgXgEZr3WJ6XngMM/N9DMIm4K8zXPCZ1Jdu0rERwO84w1WC5wkle2ubwTA4NTBg==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/whatwg-fetch": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", + "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==" + } + }, + "dependencies": { + "@types/url-parse": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@types/url-parse/-/url-parse-1.4.4.tgz", + "integrity": "sha512-KtQLad12+4T/NfSxpoDhmr22+fig3T7/08QCgmutYA6QSznSRmEtuL95GrhVV40/0otTEdFc+etRcCTqhh1q5Q==", + "dev": true + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" + }, + "typescript": { + "version": "3.9.10", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", + "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "dev": true + }, + "url-parse": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.4.tgz", + "integrity": "sha512-ITeAByWWoqutFClc/lRZnFplgXgEZr3WJ6XngMM/N9DMIm4K8zXPCZ1Jdu0rERwO84w1WC5wkle2ubwTA4NTBg==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "whatwg-fetch": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", + "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==" + } + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/package.json b/samples/openapi3/client/petstore/typescript/builds/browser/package.json new file mode 100644 index 000000000000..0d3344f8590d --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/package.json @@ -0,0 +1,33 @@ +{ + "name": "ts-petstore-client", + "version": "1.0.0", + "description": "OpenAPI client for ts-petstore-client", + "author": "OpenAPI-Generator Contributors", + "keywords": [ + "fetch", + "typescript", + "openapi-client", + "openapi-generator" + ], + "license": "Unlicense", + "main": "./dist/index.js", + "type": "module", + "module": "./dist/index.js", + "exports": { + ".": "./dist/index.js" + }, + "typings": "./dist/index.d.ts", + "scripts": { + "build": "tsc", + "prepare": "npm run build" + }, + "dependencies": { + "whatwg-fetch": "^3.0.0", + "es6-promise": "^4.2.4", + "url-parse": "^1.4.3" + }, + "devDependencies": { + "typescript": "^3.9.3", + "@types/url-parse": "1.4.4" + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/pom.xml b/samples/openapi3/client/petstore/typescript/builds/browser/pom.xml new file mode 100644 index 000000000000..6f10ad050bb2 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/pom.xml @@ -0,0 +1,60 @@ + + 4.0.0 + org.openapitools + TypeScriptBuildBrowserPetstoreClientSample + pom + 1.0-SNAPSHOT + TS Browser Petstore Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + npm-install + pre-integration-test + + exec + + + npm + + install + + + + + npm-build + pre-integration-test + + exec + + + npm + + run + build + + + + + + + + diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/rxjsStub.ts b/samples/openapi3/client/petstore/typescript/builds/browser/rxjsStub.ts new file mode 100644 index 000000000000..4c73715a2486 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/rxjsStub.ts @@ -0,0 +1,27 @@ +export class Observable { + constructor(private promise: Promise) {} + + toPromise() { + return this.promise; + } + + pipe(callback: (value: T) => S | Promise): Observable { + return new Observable(this.promise.then(callback)); + } +} + +export function from(promise: Promise) { + return new Observable(promise); +} + +export function of(value: T) { + return new Observable(Promise.resolve(value)); +} + +export function mergeMap(callback: (value: T) => Observable) { + return (value: T) => callback(value).toPromise(); +} + +export function map(callback: any) { + return callback; +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/servers.ts b/samples/openapi3/client/petstore/typescript/builds/browser/servers.ts new file mode 100644 index 000000000000..ce34c8714c0c --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/servers.ts @@ -0,0 +1,53 @@ +import { RequestContext, HttpMethod } from "./http/http"; + +export interface BaseServerConfiguration { + makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; +} + +/** + * + * Represents the configuration of a server including its + * url template and variable configuration based on the url. + * + */ +export class ServerConfiguration implements BaseServerConfiguration { + public constructor(private url: string, private variableConfiguration: T) {} + + /** + * Sets the value of the variables of this server. + * + * @param variableConfiguration a partial variable configuration for the variables contained in the url + */ + public setVariables(variableConfiguration: Partial) { + Object.assign(this.variableConfiguration, variableConfiguration); + } + + public getConfiguration(): T { + return this.variableConfiguration + } + + private getUrl() { + let replacedUrl = this.url; + for (const key in this.variableConfiguration) { + var re = new RegExp("{" + key + "}","g"); + replacedUrl = replacedUrl.replace(re, this.variableConfiguration[key]); + } + return replacedUrl + } + + /** + * Creates a new request context for this server using the url with variables + * replaced with their respective values and the endpoint of the request appended. + * + * @param endpoint the endpoint to be queried on the server + * @param httpMethod httpMethod to be used + * + */ + public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext { + return new RequestContext(this.getUrl() + endpoint, httpMethod); + } +} + +export const server1 = new ServerConfiguration<{ }>("http://petstore.swagger.io/v2", { }) + +export const servers = [server1]; diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/browser/tsconfig.json new file mode 100644 index 000000000000..2cc80c60873f --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "strict": true, + /* Basic Options */ + "target": "es6", + "esModuleInterop": true, + "moduleResolution": "node", + "declaration": true, + + /* Additional Checks */ + "noUnusedLocals": false, /* Report errors on unused locals. */ // TODO: reenable (unused imports!) + "noUnusedParameters": false, /* Report errors on unused parameters. */ // TODO: set to true again + "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + "removeComments": true, + "sourceMap": true, + "outDir": "./dist", + "noLib": false, + "lib": [ "es6", "dom" ], + }, + "exclude": [ + "dist", + "node_modules" + ], + "filesGlob": [ + "./**/*.ts", + ] +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/types/ObjectParamAPI.ts b/samples/openapi3/client/petstore/typescript/builds/browser/types/ObjectParamAPI.ts new file mode 100644 index 000000000000..bad3c9fc25ff --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/types/ObjectParamAPI.ts @@ -0,0 +1,436 @@ +import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import * as models from '../models/all'; +import { Configuration} from '../configuration' + +import { ApiResponse } from '../models/ApiResponse'; +import { Category } from '../models/Category'; +import { Order } from '../models/Order'; +import { Pet } from '../models/Pet'; +import { Tag } from '../models/Tag'; +import { User } from '../models/User'; + +import { ObservablePetApi } from "./ObservableAPI"; +import { PetApiRequestFactory, PetApiResponseProcessor} from "../apis/PetApi"; + +export interface PetApiAddPetRequest { + /** + * Pet object that needs to be added to the store + * @type Pet + * @memberof PetApiaddPet + */ + pet: Pet +} + +export interface PetApiDeletePetRequest { + /** + * Pet id to delete + * @type number + * @memberof PetApideletePet + */ + petId: number + /** + * + * @type string + * @memberof PetApideletePet + */ + apiKey?: string +} + +export interface PetApiFindPetsByStatusRequest { + /** + * Status values that need to be considered for filter + * @type Array<'available' | 'pending' | 'sold'> + * @memberof PetApifindPetsByStatus + */ + status: Array<'available' | 'pending' | 'sold'> +} + +export interface PetApiFindPetsByTagsRequest { + /** + * Tags to filter by + * @type Array<string> + * @memberof PetApifindPetsByTags + */ + tags: Array +} + +export interface PetApiGetPetByIdRequest { + /** + * ID of pet to return + * @type number + * @memberof PetApigetPetById + */ + petId: number +} + +export interface PetApiUpdatePetRequest { + /** + * Pet object that needs to be added to the store + * @type Pet + * @memberof PetApiupdatePet + */ + pet: Pet +} + +export interface PetApiUpdatePetWithFormRequest { + /** + * ID of pet that needs to be updated + * @type number + * @memberof PetApiupdatePetWithForm + */ + petId: number + /** + * Updated name of the pet + * @type string + * @memberof PetApiupdatePetWithForm + */ + name?: string + /** + * Updated status of the pet + * @type string + * @memberof PetApiupdatePetWithForm + */ + status?: string +} + +export interface PetApiUploadFileRequest { + /** + * ID of pet to update + * @type number + * @memberof PetApiuploadFile + */ + petId: number + /** + * Additional data to pass to server + * @type string + * @memberof PetApiuploadFile + */ + additionalMetadata?: string + /** + * file to upload + * @type HttpFile + * @memberof PetApiuploadFile + */ + file?: HttpFile +} + +export class ObjectPetApi { + private api: ObservablePetApi + + public constructor(configuration: Configuration, requestFactory?: PetApiRequestFactory, responseProcessor?: PetApiResponseProcessor) { + this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); + } + + /** + * + * Add a new pet to the store + * @param param the request object + */ + public addPet(param: PetApiAddPetRequest, options?: Configuration): Promise { + return this.api.addPet(param.pet, options).toPromise(); + } + + /** + * + * Deletes a pet + * @param param the request object + */ + public deletePet(param: PetApiDeletePetRequest, options?: Configuration): Promise { + return this.api.deletePet(param.petId, param.apiKey, options).toPromise(); + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param param the request object + */ + public findPetsByStatus(param: PetApiFindPetsByStatusRequest, options?: Configuration): Promise> { + return this.api.findPetsByStatus(param.status, options).toPromise(); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param param the request object + */ + public findPetsByTags(param: PetApiFindPetsByTagsRequest, options?: Configuration): Promise> { + return this.api.findPetsByTags(param.tags, options).toPromise(); + } + + /** + * Returns a single pet + * Find pet by ID + * @param param the request object + */ + public getPetById(param: PetApiGetPetByIdRequest, options?: Configuration): Promise { + return this.api.getPetById(param.petId, options).toPromise(); + } + + /** + * + * Update an existing pet + * @param param the request object + */ + public updatePet(param: PetApiUpdatePetRequest, options?: Configuration): Promise { + return this.api.updatePet(param.pet, options).toPromise(); + } + + /** + * + * Updates a pet in the store with form data + * @param param the request object + */ + public updatePetWithForm(param: PetApiUpdatePetWithFormRequest, options?: Configuration): Promise { + return this.api.updatePetWithForm(param.petId, param.name, param.status, options).toPromise(); + } + + /** + * + * uploads an image + * @param param the request object + */ + public uploadFile(param: PetApiUploadFileRequest, options?: Configuration): Promise { + return this.api.uploadFile(param.petId, param.additionalMetadata, param.file, options).toPromise(); + } + +} + +import { ObservableStoreApi } from "./ObservableAPI"; +import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi"; + +export interface StoreApiDeleteOrderRequest { + /** + * ID of the order that needs to be deleted + * @type string + * @memberof StoreApideleteOrder + */ + orderId: string +} + +export interface StoreApiGetInventoryRequest { +} + +export interface StoreApiGetOrderByIdRequest { + /** + * ID of pet that needs to be fetched + * @type number + * @memberof StoreApigetOrderById + */ + orderId: number +} + +export interface StoreApiPlaceOrderRequest { + /** + * order placed for purchasing the pet + * @type Order + * @memberof StoreApiplaceOrder + */ + order: Order +} + +export class ObjectStoreApi { + private api: ObservableStoreApi + + public constructor(configuration: Configuration, requestFactory?: StoreApiRequestFactory, responseProcessor?: StoreApiResponseProcessor) { + this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param param the request object + */ + public deleteOrder(param: StoreApiDeleteOrderRequest, options?: Configuration): Promise { + return this.api.deleteOrder(param.orderId, options).toPromise(); + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + * @param param the request object + */ + public getInventory(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise<{ [key: string]: number; }> { + return this.api.getInventory( options).toPromise(); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * Find purchase order by ID + * @param param the request object + */ + public getOrderById(param: StoreApiGetOrderByIdRequest, options?: Configuration): Promise { + return this.api.getOrderById(param.orderId, options).toPromise(); + } + + /** + * + * Place an order for a pet + * @param param the request object + */ + public placeOrder(param: StoreApiPlaceOrderRequest, options?: Configuration): Promise { + return this.api.placeOrder(param.order, options).toPromise(); + } + +} + +import { ObservableUserApi } from "./ObservableAPI"; +import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; + +export interface UserApiCreateUserRequest { + /** + * Created user object + * @type User + * @memberof UserApicreateUser + */ + user: User +} + +export interface UserApiCreateUsersWithArrayInputRequest { + /** + * List of user object + * @type Array<User> + * @memberof UserApicreateUsersWithArrayInput + */ + user: Array +} + +export interface UserApiCreateUsersWithListInputRequest { + /** + * List of user object + * @type Array<User> + * @memberof UserApicreateUsersWithListInput + */ + user: Array +} + +export interface UserApiDeleteUserRequest { + /** + * The name that needs to be deleted + * @type string + * @memberof UserApideleteUser + */ + username: string +} + +export interface UserApiGetUserByNameRequest { + /** + * The name that needs to be fetched. Use user1 for testing. + * @type string + * @memberof UserApigetUserByName + */ + username: string +} + +export interface UserApiLoginUserRequest { + /** + * The user name for login + * @type string + * @memberof UserApiloginUser + */ + username: string + /** + * The password for login in clear text + * @type string + * @memberof UserApiloginUser + */ + password: string +} + +export interface UserApiLogoutUserRequest { +} + +export interface UserApiUpdateUserRequest { + /** + * name that need to be deleted + * @type string + * @memberof UserApiupdateUser + */ + username: string + /** + * Updated user object + * @type User + * @memberof UserApiupdateUser + */ + user: User +} + +export class ObjectUserApi { + private api: ObservableUserApi + + public constructor(configuration: Configuration, requestFactory?: UserApiRequestFactory, responseProcessor?: UserApiResponseProcessor) { + this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); + } + + /** + * This can only be done by the logged in user. + * Create user + * @param param the request object + */ + public createUser(param: UserApiCreateUserRequest, options?: Configuration): Promise { + return this.api.createUser(param.user, options).toPromise(); + } + + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithArrayInput(param: UserApiCreateUsersWithArrayInputRequest, options?: Configuration): Promise { + return this.api.createUsersWithArrayInput(param.user, options).toPromise(); + } + + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithListInput(param: UserApiCreateUsersWithListInputRequest, options?: Configuration): Promise { + return this.api.createUsersWithListInput(param.user, options).toPromise(); + } + + /** + * This can only be done by the logged in user. + * Delete user + * @param param the request object + */ + public deleteUser(param: UserApiDeleteUserRequest, options?: Configuration): Promise { + return this.api.deleteUser(param.username, options).toPromise(); + } + + /** + * + * Get user by user name + * @param param the request object + */ + public getUserByName(param: UserApiGetUserByNameRequest, options?: Configuration): Promise { + return this.api.getUserByName(param.username, options).toPromise(); + } + + /** + * + * Logs user into the system + * @param param the request object + */ + public loginUser(param: UserApiLoginUserRequest, options?: Configuration): Promise { + return this.api.loginUser(param.username, param.password, options).toPromise(); + } + + /** + * + * Logs out current logged in user session + * @param param the request object + */ + public logoutUser(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise { + return this.api.logoutUser( options).toPromise(); + } + + /** + * This can only be done by the logged in user. + * Updated user + * @param param the request object + */ + public updateUser(param: UserApiUpdateUserRequest, options?: Configuration): Promise { + return this.api.updateUser(param.username, param.user, options).toPromise(); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/browser/types/ObservableAPI.ts new file mode 100644 index 000000000000..74f57a7e1c7c --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/types/ObservableAPI.ts @@ -0,0 +1,550 @@ +import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import * as models from '../models/all'; +import { Configuration} from '../configuration' +import { Observable, of, from } from '../rxjsStub'; +import {mergeMap, map} from '../rxjsStub'; +import { ApiResponse } from '../models/ApiResponse'; +import { Category } from '../models/Category'; +import { Order } from '../models/Order'; +import { Pet } from '../models/Pet'; +import { Tag } from '../models/Tag'; +import { User } from '../models/User'; + +import { PetApiRequestFactory, PetApiResponseProcessor} from "../apis/PetApi"; +export class ObservablePetApi { + private requestFactory: PetApiRequestFactory; + private responseProcessor: PetApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: PetApiRequestFactory, + responseProcessor?: PetApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new PetApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new PetApiResponseProcessor(); + } + + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPet(pet: Pet, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.addPet(pet, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPet(rsp))); + })); + } + + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.deletePet(petId, apiKey, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePet(rsp))); + })); + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.findPetsByStatus(status, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatus(rsp))); + })); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTags(tags: Array, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.findPetsByTags(tags, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTags(rsp))); + })); + } + + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetById(petId: number, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.getPetById(petId, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetById(rsp))); + })); + } + + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePet(pet: Pet, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.updatePet(pet, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePet(rsp))); + })); + } + + /** + * + * Updates a pet in the store with form data + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + */ + public updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.updatePetWithForm(petId, name, status, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithForm(rsp))); + })); + } + + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.uploadFile(petId, additionalMetadata, file, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFile(rsp))); + })); + } + +} + +import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi"; +export class ObservableStoreApi { + private requestFactory: StoreApiRequestFactory; + private responseProcessor: StoreApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: StoreApiRequestFactory, + responseProcessor?: StoreApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new StoreApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new StoreApiResponseProcessor(); + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder(orderId: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.deleteOrder(orderId, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrder(rsp))); + })); + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + const requestContextPromise = this.requestFactory.getInventory(_options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventory(rsp))); + })); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderById(orderId: number, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.getOrderById(orderId, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderById(rsp))); + })); + } + + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrder(order: Order, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.placeOrder(order, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrder(rsp))); + })); + } + +} + +import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; +export class ObservableUserApi { + private requestFactory: UserApiRequestFactory; + private responseProcessor: UserApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: UserApiRequestFactory, + responseProcessor?: UserApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new UserApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new UserApiResponseProcessor(); + } + + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUser(user: User, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.createUser(user, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUser(rsp))); + })); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.createUsersWithArrayInput(user, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInput(rsp))); + })); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.createUsersWithListInput(user, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInput(rsp))); + })); + } + + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUser(username: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.deleteUser(username, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUser(rsp))); + })); + } + + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName(username: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.getUserByName(username, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByName(rsp))); + })); + } + + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser(username: string, password: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.loginUser(username, password, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUser(rsp))); + })); + } + + /** + * + * Logs out current logged in user session + */ + public logoutUser(_options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.logoutUser(_options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUser(rsp))); + })); + } + + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUser(username: string, user: User, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.updateUser(username, user, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUser(rsp))); + })); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/browser/types/PromiseAPI.ts new file mode 100644 index 000000000000..92d57b673df0 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/types/PromiseAPI.ts @@ -0,0 +1,272 @@ +import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import * as models from '../models/all'; +import { Configuration} from '../configuration' + +import { ApiResponse } from '../models/ApiResponse'; +import { Category } from '../models/Category'; +import { Order } from '../models/Order'; +import { Pet } from '../models/Pet'; +import { Tag } from '../models/Tag'; +import { User } from '../models/User'; +import { ObservablePetApi } from './ObservableAPI'; + +import { PetApiRequestFactory, PetApiResponseProcessor} from "../apis/PetApi"; +export class PromisePetApi { + private api: ObservablePetApi + + public constructor( + configuration: Configuration, + requestFactory?: PetApiRequestFactory, + responseProcessor?: PetApiResponseProcessor + ) { + this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); + } + + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPet(pet: Pet, _options?: Configuration): Promise { + const result = this.api.addPet(pet, _options); + return result.toPromise(); + } + + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet(petId: number, apiKey?: string, _options?: Configuration): Promise { + const result = this.api.deletePet(petId, apiKey, _options); + return result.toPromise(); + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Promise> { + const result = this.api.findPetsByStatus(status, _options); + return result.toPromise(); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTags(tags: Array, _options?: Configuration): Promise> { + const result = this.api.findPetsByTags(tags, _options); + return result.toPromise(); + } + + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetById(petId: number, _options?: Configuration): Promise { + const result = this.api.getPetById(petId, _options); + return result.toPromise(); + } + + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePet(pet: Pet, _options?: Configuration): Promise { + const result = this.api.updatePet(pet, _options); + return result.toPromise(); + } + + /** + * + * Updates a pet in the store with form data + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + */ + public updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Promise { + const result = this.api.updatePetWithForm(petId, name, status, _options); + return result.toPromise(); + } + + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Promise { + const result = this.api.uploadFile(petId, additionalMetadata, file, _options); + return result.toPromise(); + } + + +} + + + +import { ObservableStoreApi } from './ObservableAPI'; + +import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi"; +export class PromiseStoreApi { + private api: ObservableStoreApi + + public constructor( + configuration: Configuration, + requestFactory?: StoreApiRequestFactory, + responseProcessor?: StoreApiResponseProcessor + ) { + this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder(orderId: string, _options?: Configuration): Promise { + const result = this.api.deleteOrder(orderId, _options); + return result.toPromise(); + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventory(_options?: Configuration): Promise<{ [key: string]: number; }> { + const result = this.api.getInventory(_options); + return result.toPromise(); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderById(orderId: number, _options?: Configuration): Promise { + const result = this.api.getOrderById(orderId, _options); + return result.toPromise(); + } + + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrder(order: Order, _options?: Configuration): Promise { + const result = this.api.placeOrder(order, _options); + return result.toPromise(); + } + + +} + + + +import { ObservableUserApi } from './ObservableAPI'; + +import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; +export class PromiseUserApi { + private api: ObservableUserApi + + public constructor( + configuration: Configuration, + requestFactory?: UserApiRequestFactory, + responseProcessor?: UserApiResponseProcessor + ) { + this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); + } + + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUser(user: User, _options?: Configuration): Promise { + const result = this.api.createUser(user, _options); + return result.toPromise(); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInput(user: Array, _options?: Configuration): Promise { + const result = this.api.createUsersWithArrayInput(user, _options); + return result.toPromise(); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInput(user: Array, _options?: Configuration): Promise { + const result = this.api.createUsersWithListInput(user, _options); + return result.toPromise(); + } + + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUser(username: string, _options?: Configuration): Promise { + const result = this.api.deleteUser(username, _options); + return result.toPromise(); + } + + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName(username: string, _options?: Configuration): Promise { + const result = this.api.getUserByName(username, _options); + return result.toPromise(); + } + + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser(username: string, password: string, _options?: Configuration): Promise { + const result = this.api.loginUser(username, password, _options); + return result.toPromise(); + } + + /** + * + * Logs out current logged in user session + */ + public logoutUser(_options?: Configuration): Promise { + const result = this.api.logoutUser(_options); + return result.toPromise(); + } + + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUser(username: string, user: User, _options?: Configuration): Promise { + const result = this.api.updateUser(username, user, _options); + return result.toPromise(); + } + + +} + + + diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/util.ts b/samples/openapi3/client/petstore/typescript/builds/browser/util.ts new file mode 100644 index 000000000000..96ea3dfdc770 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/browser/util.ts @@ -0,0 +1,37 @@ +/** + * Returns if a specific http code is in a given code range + * where the code range is defined as a combination of digits + * and "X" (the letter X) with a length of 3 + * + * @param codeRange string with length 3 consisting of digits and "X" (the letter X) + * @param code the http status code to be checked against the code range + */ +export function isCodeInRange(codeRange: string, code: number): boolean { + // This is how the default value is encoded in OAG + if (codeRange === "0") { + return true; + } + if (codeRange == code.toString()) { + return true; + } else { + const codeString = code.toString(); + if (codeString.length != codeRange.length) { + return false; + } + for (let i = 0; i < codeString.length; i++) { + if (codeRange.charAt(i) != "X" && codeRange.charAt(i) != codeString.charAt(i)) { + return false; + } + } + return true; + } +} + +/** +* Returns if it can consume form +* +* @param consumes array +*/ +export function canConsumeForm(contentTypes: string[]): boolean { + return contentTypes.indexOf('multipart/form-data') !== -1 +} diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/auth/auth.ts index 49340932e11b..be50274b9d65 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/auth/auth.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/auth/auth.ts @@ -1,4 +1,3 @@ -// typings for btoa are incorrect import { RequestContext } from "../http/http"; /** diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts index f19e206b19ff..579326776771 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts @@ -1,5 +1,3 @@ -// typings of url-parse are incorrect... -// @ts-ignore import * as URLParse from "url-parse"; import { Observable, from } from '../rxjsStub'; diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/index.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/index.ts index 127f89d99723..89069bd11889 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/index.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/index.ts @@ -5,6 +5,7 @@ export { createConfiguration } from "./configuration" export { Configuration } from "./configuration" export * from "./apis/exception"; export * from "./servers"; +export { RequiredError } from "./apis/baseapi"; export { PromiseMiddleware as Middleware } from './middleware'; export { PromiseDefaultApi as DefaultApi } from './types/PromiseAPI'; diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json index 1605e85eb131..8a8ba4a20609 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json @@ -11,6 +11,10 @@ ], "license": "Unlicense", "main": "./dist/index.js", + "type": "commonjs", + "exports": { + ".": "./dist/index.js" + }, "typings": "./dist/index.d.ts", "scripts": { "build": "tsc", @@ -22,6 +26,7 @@ "url-parse": "^1.4.3" }, "devDependencies": { - "typescript": "^3.9.3" + "typescript": "^3.9.3", + "@types/url-parse": "1.4.4" } } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json index 6576215ef877..aa173eb68f32 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json @@ -3,7 +3,6 @@ "strict": true, /* Basic Options */ "target": "es5", - "module": "commonjs", "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts index 3b6e1461d924..7daeb7728cb1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts @@ -3,8 +3,6 @@ import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import * as http from 'http'; import * as https from 'https'; -// typings of url-parse are incorrect... -// @ts-ignore import * as URLParse from "url-parse"; import { Observable, from } from '../rxjsStub'; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/index.ts b/samples/openapi3/client/petstore/typescript/builds/default/index.ts index de89bb05e702..61ec7fec0cec 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/index.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/index.ts @@ -5,6 +5,7 @@ export { createConfiguration } from "./configuration" export { Configuration } from "./configuration" export * from "./apis/exception"; export * from "./servers"; +export { RequiredError } from "./apis/baseapi"; export { PromiseMiddleware as Middleware } from './middleware'; export { PromisePetApi as PetApi, PromiseStoreApi as StoreApi, PromiseUserApi as UserApi } from './types/PromiseAPI'; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/package.json b/samples/openapi3/client/petstore/typescript/builds/default/package.json index f26767636102..b9209fdd8072 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/package.json @@ -11,6 +11,10 @@ ], "license": "Unlicense", "main": "./dist/index.js", + "type": "commonjs", + "exports": { + ".": "./dist/index.js" + }, "typings": "./dist/index.d.ts", "scripts": { "build": "tsc", @@ -26,6 +30,7 @@ "url-parse": "^1.4.3" }, "devDependencies": { - "typescript": "^3.9.3" + "typescript": "^3.9.3", + "@types/url-parse": "1.4.4" } } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json index 3ada5c62a9f2..4a8d5cb2f334 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json @@ -3,7 +3,6 @@ "strict": true, /* Basic Options */ "target": "es5", - "module": "commonjs", "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/deno/auth/auth.ts index 85086dde5fae..2f891fb94ea5 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/auth/auth.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/auth/auth.ts @@ -1,4 +1,3 @@ -// typings for btoa are incorrect import { RequestContext } from "../http/http.ts"; /** diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/index.ts b/samples/openapi3/client/petstore/typescript/builds/deno/index.ts index c81b0e2421d0..b73e795b265e 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/index.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/index.ts @@ -5,6 +5,7 @@ export { createConfiguration } from "./configuration.ts" export type { Configuration } from "./configuration.ts" export * from "./apis/exception.ts"; export * from "./servers.ts"; +export { RequiredError } from "./apis/baseapi.ts"; export type { PromiseMiddleware as Middleware } from './middleware.ts'; export { PromisePetApi as PetApi, PromiseStoreApi as StoreApi, PromiseUserApi as UserApi } from './types/PromiseAPI.ts'; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts index 3b6e1461d924..7daeb7728cb1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts @@ -3,8 +3,6 @@ import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import * as http from 'http'; import * as https from 'https'; -// typings of url-parse are incorrect... -// @ts-ignore import * as URLParse from "url-parse"; import { Observable, from } from '../rxjsStub'; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/index.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/index.ts index 4d48e5222adf..fd45f69c4278 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/index.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/index.ts @@ -5,6 +5,7 @@ export { createConfiguration } from "./configuration" export { Configuration } from "./configuration" export * from "./apis/exception"; export * from "./servers"; +export { RequiredError } from "./apis/baseapi"; export { PromiseMiddleware as Middleware } from './middleware'; export { PromisePetApi as PetApi, PromiseStoreApi as StoreApi, PromiseUserApi as UserApi } from './types/PromiseAPI'; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json index 71908ad48cae..ee7b3ee8b046 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json @@ -11,6 +11,10 @@ ], "license": "Unlicense", "main": "./dist/index.js", + "type": "commonjs", + "exports": { + ".": "./dist/index.js" + }, "typings": "./dist/index.d.ts", "scripts": { "build": "tsc", @@ -27,6 +31,7 @@ "url-parse": "^1.4.3" }, "devDependencies": { - "typescript": "^3.9.3" + "typescript": "^3.9.3", + "@types/url-parse": "1.4.4" } } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json index c09901ad10fb..e57dd6fe3b8c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json @@ -3,7 +3,6 @@ "strict": true, /* Basic Options */ "target": "es5", - "module": "commonjs", "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/auth/auth.ts index ed2aa2bfe6db..7c393656367d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/auth/auth.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/auth/auth.ts @@ -1,4 +1,3 @@ -// typings for btoa are incorrect import { RequestContext } from "../http/http"; /** diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts index 4b9ef54beeb5..8e4d7d66f282 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts @@ -1,5 +1,3 @@ -// typings of url-parse are incorrect... -// @ts-ignore import * as URLParse from "url-parse"; import { Observable, from } from '../rxjsStub'; diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/index.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/index.ts index de89bb05e702..61ec7fec0cec 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/index.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/index.ts @@ -5,6 +5,7 @@ export { createConfiguration } from "./configuration" export { Configuration } from "./configuration" export * from "./apis/exception"; export * from "./servers"; +export { RequiredError } from "./apis/baseapi"; export { PromiseMiddleware as Middleware } from './middleware'; export { PromisePetApi as PetApi, PromiseStoreApi as StoreApi, PromiseUserApi as UserApi } from './types/PromiseAPI'; diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/package-lock.json b/samples/openapi3/client/petstore/typescript/builds/jquery/package-lock.json index 31fa281aeedb..eda6ec3587df 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/package-lock.json +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/package-lock.json @@ -1,8 +1,86 @@ { "name": "ts-petstore-client", "version": "1.0.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "ts-petstore-client", + "version": "1.0.0", + "license": "Unlicense", + "dependencies": { + "@types/jquery": "^3.3.29", + "es6-promise": "^4.2.4", + "jquery": "^3.4.1", + "url-parse": "^1.4.3" + }, + "devDependencies": { + "@types/url-parse": "1.4.4", + "typescript": "^3.9.3" + } + }, + "node_modules/@types/jquery": { + "version": "3.3.29", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.3.29.tgz", + "integrity": "sha512-FhJvBninYD36v3k6c+bVk1DSZwh7B5Dpb/Pyk3HKVsiohn0nhbefZZ+3JXbWQhFyt0MxSl2jRDdGQPHeOHFXrQ==", + "dependencies": { + "@types/sizzle": "*" + } + }, + "node_modules/@types/sizzle": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.2.tgz", + "integrity": "sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg==" + }, + "node_modules/@types/url-parse": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@types/url-parse/-/url-parse-1.4.4.tgz", + "integrity": "sha512-KtQLad12+4T/NfSxpoDhmr22+fig3T7/08QCgmutYA6QSznSRmEtuL95GrhVV40/0otTEdFc+etRcCTqhh1q5Q==", + "dev": true + }, + "node_modules/es6-promise": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz", + "integrity": "sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==" + }, + "node_modules/jquery": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz", + "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==" + }, + "node_modules/querystringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", + "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==" + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" + }, + "node_modules/typescript": { + "version": "3.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", + "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/url-parse": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz", + "integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + } + }, "dependencies": { "@types/jquery": { "version": "3.3.29", @@ -17,6 +95,12 @@ "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.2.tgz", "integrity": "sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg==" }, + "@types/url-parse": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@types/url-parse/-/url-parse-1.4.4.tgz", + "integrity": "sha512-KtQLad12+4T/NfSxpoDhmr22+fig3T7/08QCgmutYA6QSznSRmEtuL95GrhVV40/0otTEdFc+etRcCTqhh1q5Q==", + "dev": true + }, "es6-promise": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz", diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/package.json b/samples/openapi3/client/petstore/typescript/builds/jquery/package.json index 7c35bc6c6dd3..6b153b5650e4 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/package.json @@ -11,6 +11,10 @@ ], "license": "Unlicense", "main": "./dist/index.js", + "type": "commonjs", + "exports": { + ".": "./dist/index.js" + }, "typings": "./dist/index.d.ts", "scripts": { "build": "tsc", @@ -23,6 +27,7 @@ "url-parse": "^1.4.3" }, "devDependencies": { - "typescript": "^3.9.3" + "typescript": "^3.9.3", + "@types/url-parse": "1.4.4" } } diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json index 6576215ef877..aa173eb68f32 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json @@ -3,7 +3,6 @@ "strict": true, /* Basic Options */ "target": "es5", - "module": "commonjs", "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts index 3b6e1461d924..7daeb7728cb1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts @@ -3,8 +3,6 @@ import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import * as http from 'http'; import * as https from 'https'; -// typings of url-parse are incorrect... -// @ts-ignore import * as URLParse from "url-parse"; import { Observable, from } from '../rxjsStub'; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/index.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/index.ts index 49a513cbb84c..14f1249f31a3 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/index.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/index.ts @@ -5,6 +5,7 @@ export { createConfiguration } from "./configuration" export { Configuration } from "./configuration" export * from "./apis/exception"; export * from "./servers"; +export { RequiredError } from "./apis/baseapi"; export { PromiseMiddleware as Middleware } from './middleware'; export { PetApiAddPetRequest, PetApiDeletePetRequest, PetApiFindPetsByStatusRequest, PetApiFindPetsByTagsRequest, PetApiGetPetByIdRequest, PetApiUpdatePetRequest, PetApiUpdatePetWithFormRequest, PetApiUploadFileRequest, ObjectPetApi as PetApi, StoreApiDeleteOrderRequest, StoreApiGetInventoryRequest, StoreApiGetOrderByIdRequest, StoreApiPlaceOrderRequest, ObjectStoreApi as StoreApi, UserApiCreateUserRequest, UserApiCreateUsersWithArrayInputRequest, UserApiCreateUsersWithListInputRequest, UserApiDeleteUserRequest, UserApiGetUserByNameRequest, UserApiLoginUserRequest, UserApiLogoutUserRequest, UserApiUpdateUserRequest, ObjectUserApi as UserApi } from './types/ObjectParamAPI'; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json index f26767636102..b9209fdd8072 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json @@ -11,6 +11,10 @@ ], "license": "Unlicense", "main": "./dist/index.js", + "type": "commonjs", + "exports": { + ".": "./dist/index.js" + }, "typings": "./dist/index.d.ts", "scripts": { "build": "tsc", @@ -26,6 +30,7 @@ "url-parse": "^1.4.3" }, "devDependencies": { - "typescript": "^3.9.3" + "typescript": "^3.9.3", + "@types/url-parse": "1.4.4" } } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json index 3ada5c62a9f2..4a8d5cb2f334 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json @@ -3,7 +3,6 @@ "strict": true, /* Basic Options */ "target": "es5", - "module": "commonjs", "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/tests/browser/.gitignore b/samples/openapi3/client/petstore/typescript/tests/browser/.gitignore new file mode 100644 index 000000000000..87517b411c9f --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/tests/browser/.gitignore @@ -0,0 +1,5 @@ +node_modules +.DS_Store +dist +bundle +*.local \ No newline at end of file diff --git a/samples/openapi3/client/petstore/typescript/tests/browser/package-lock.json b/samples/openapi3/client/petstore/typescript/tests/browser/package-lock.json new file mode 100644 index 000000000000..ab8a207c1e32 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/tests/browser/package-lock.json @@ -0,0 +1,5958 @@ +{ + "name": "typescript-test", + "version": "0.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "typescript-test", + "version": "0.0.0", + "dependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@web/test-runner": "^0.13.26", + "@web/test-runner-puppeteer": "^0.10.5", + "ts-petstore-client": "file:../../builds/browser" + }, + "devDependencies": { + "esbuild": "^0.14.14", + "typescript": "^4.4.4" + } + }, + "../../builds/browser": { + "name": "ts-petstore-client", + "version": "1.0.0", + "license": "Unlicense", + "dependencies": { + "es6-promise": "^4.2.4", + "url-parse": "^1.4.3", + "whatwg-fetch": "^3.0.0" + }, + "devDependencies": { + "@types/url-parse": "1.4.4", + "typescript": "^3.9.3" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "dependencies": { + "@babel/highlight": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz", + "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==", + "dependencies": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@esm-bundle/chai": { + "version": "4.3.4-fix.0", + "resolved": "https://registry.npmjs.org/@esm-bundle/chai/-/chai-4.3.4-fix.0.tgz", + "integrity": "sha512-26SKdM4uvDWlY8/OOOxSB1AqQWeBosCX3wRYUZO7enTAj03CtVxIiCimYVG2WpULcyV51qapK4qTovwkUr5Mlw==", + "dependencies": { + "@types/chai": "^4.2.12" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "11.2.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.2.1.tgz", + "integrity": "sha512-yc2n43jcqVyGE2sqV5/YCmocy9ArjVAP/BeXyTtADTBBX6V0e5UMqwO8CdQ0kzjb6zu5P1qMzsScCMRvE9OlVg==", + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "builtin-modules": "^3.1.0", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">= 10.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" + } + }, + "node_modules/@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dependencies": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" + } + }, + "node_modules/@types/accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/babel__code-frame": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@types/babel__code-frame/-/babel__code-frame-7.0.3.tgz", + "integrity": "sha512-2TN6oiwtNjOezilFVl77zwdNPwQWaDBBCCWWxyo1ctiO3vAtd7H/aB/CBJdw9+kqq3+latD0SXoedIuHySSZWw==" + }, + "node_modules/@types/body-parser": { + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/chai": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz", + "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==" + }, + "node_modules/@types/co-body": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@types/co-body/-/co-body-6.1.0.tgz", + "integrity": "sha512-3e0q2jyDAnx/DSZi0z2H0yoZ2wt5yRDZ+P7ymcMObvq0ufWRT4tsajyO+Q1VwVWiv9PRR4W3YEjEzBjeZlhF+w==", + "dependencies": { + "@types/node": "*", + "@types/qs": "*" + } + }, + "node_modules/@types/command-line-args": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@types/command-line-args/-/command-line-args-5.2.0.tgz", + "integrity": "sha512-UuKzKpJJ/Ief6ufIaIzr3A/0XnluX7RvFgwkV89Yzvm77wCh1kFaFmqN8XEnGcN62EuHdedQjEMb8mYxFLGPyA==" + }, + "node_modules/@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-0mPF08jn9zYI0n0Q/Pnz7C4kThdSt+6LD4amsrYDDpgBfrVWa3TcCOxKX1zkGgYniGagRv8heN2cbh+CAn+uuQ==" + }, + "node_modules/@types/convert-source-map": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@types/convert-source-map/-/convert-source-map-1.5.2.tgz", + "integrity": "sha512-tHs++ZeXer40kCF2JpE51Hg7t4HPa18B1b1Dzy96S0eCw8QKECNMYMfwa1edK/x8yCN0r4e6ewvLcc5CsVGkdg==" + }, + "node_modules/@types/cookies": { + "version": "0.7.7", + "resolved": "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.7.tgz", + "integrity": "sha512-h7BcvPUogWbKCzBR2lY4oqaZbO3jXZksexYJVFvkrFeLgbZjQkU4x8pRq6eg2MHXQhY0McQdqmmsxRWlVAHooA==", + "dependencies": { + "@types/connect": "*", + "@types/express": "*", + "@types/keygrip": "*", + "@types/node": "*" + } + }, + "node_modules/@types/debounce": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/debounce/-/debounce-1.2.1.tgz", + "integrity": "sha512-epMsEE85fi4lfmJUH/89/iV/LI+F5CvNIvmgs5g5jYFPfhO2S/ae8WSsLOKWdwtoaZw9Q2IhJ4tQ5tFCcS/4HA==" + }, + "node_modules/@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==" + }, + "node_modules/@types/express": { + "version": "4.17.13", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", + "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.18", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.17.28", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz", + "integrity": "sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig==", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } + }, + "node_modules/@types/http-assert": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.3.tgz", + "integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==" + }, + "node_modules/@types/http-errors": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-1.8.2.tgz", + "integrity": "sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w==" + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==" + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/keygrip": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz", + "integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==" + }, + "node_modules/@types/koa": { + "version": "2.13.4", + "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.4.tgz", + "integrity": "sha512-dfHYMfU+z/vKtQB7NUrthdAEiSvnLebvBjwHtfFmpZmB7em2N3WVQdHgnFq+xvyVgxW5jKDmjWfLD3lw4g4uTw==", + "dependencies": { + "@types/accepts": "*", + "@types/content-disposition": "*", + "@types/cookies": "*", + "@types/http-assert": "*", + "@types/http-errors": "*", + "@types/keygrip": "*", + "@types/koa-compose": "*", + "@types/node": "*" + } + }, + "node_modules/@types/koa-compose": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/@types/koa-compose/-/koa-compose-3.2.5.tgz", + "integrity": "sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==", + "dependencies": { + "@types/koa": "*" + } + }, + "node_modules/@types/mime": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", + "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==" + }, + "node_modules/@types/mocha": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.3.tgz", + "integrity": "sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw==" + }, + "node_modules/@types/node": { + "version": "17.0.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.13.tgz", + "integrity": "sha512-Y86MAxASe25hNzlDbsviXl8jQHb0RDvKt4c40ZJQ1Don0AAL0STLZSs4N+6gLEO55pedy7r2cLwS+ZDxPm/2Bw==" + }, + "node_modules/@types/parse5": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz", + "integrity": "sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==" + }, + "node_modules/@types/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==" + }, + "node_modules/@types/range-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", + "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==" + }, + "node_modules/@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.13.10", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz", + "integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/yauzl": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz", + "integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@web/browser-logs": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@web/browser-logs/-/browser-logs-0.2.5.tgz", + "integrity": "sha512-Qxo1wY/L7yILQqg0jjAaueh+tzdORXnZtxQgWH23SsTCunz9iq9FvsZa8Q5XlpjnZ3vLIsFEuEsCMqFeohJnEg==", + "dependencies": { + "errorstacks": "^2.2.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@web/config-loader": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@web/config-loader/-/config-loader-0.1.3.tgz", + "integrity": "sha512-XVKH79pk4d3EHRhofete8eAnqto1e8mCRAqPV00KLNFzCWSe8sWmLnqKCqkPNARC6nksMaGrATnA5sPDRllMpQ==", + "dependencies": { + "semver": "^7.3.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@web/dev-server": { + "version": "0.1.29", + "resolved": "https://registry.npmjs.org/@web/dev-server/-/dev-server-0.1.29.tgz", + "integrity": "sha512-oDz6vC9JEDZd4ZTno+SV57zCpsQl9v5LOkGuWGyei5gx5xu8NVDvh2IgTugz6DhZnffsSE6Zi0ubs+AhonLnGA==", + "dependencies": { + "@babel/code-frame": "^7.12.11", + "@types/command-line-args": "^5.0.0", + "@web/config-loader": "^0.1.3", + "@web/dev-server-core": "^0.3.17", + "@web/dev-server-rollup": "^0.3.13", + "camelcase": "^6.2.0", + "command-line-args": "^5.1.1", + "command-line-usage": "^6.1.1", + "debounce": "^1.2.0", + "deepmerge": "^4.2.2", + "ip": "^1.1.5", + "nanocolors": "^0.2.1", + "open": "^8.0.2", + "portfinder": "^1.0.28" + }, + "bin": { + "wds": "dist/bin.js", + "web-dev-server": "dist/bin.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@web/dev-server-core": { + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@web/dev-server-core/-/dev-server-core-0.3.17.tgz", + "integrity": "sha512-vN1dwQ8yDHGiAvCeUo9xFfjo+pFl8TW+pON7k9kfhbegrrB8CKhJDUxmHbZsyQUmjf/iX57/LhuWj1xGhRL8AA==", + "dependencies": { + "@types/koa": "^2.11.6", + "@types/ws": "^7.4.0", + "@web/parse5-utils": "^1.2.0", + "chokidar": "^3.4.3", + "clone": "^2.1.2", + "es-module-lexer": "^0.9.0", + "get-stream": "^6.0.0", + "is-stream": "^2.0.0", + "isbinaryfile": "^4.0.6", + "koa": "^2.13.0", + "koa-etag": "^4.0.0", + "koa-send": "^5.0.1", + "koa-static": "^5.0.0", + "lru-cache": "^6.0.0", + "mime-types": "^2.1.27", + "parse5": "^6.0.1", + "picomatch": "^2.2.2", + "ws": "^7.4.2" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@web/dev-server-core/node_modules/ws": { + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.6.tgz", + "integrity": "sha512-6GLgCqo2cy2A2rjCNFlxQS6ZljG/coZfZXclldI8FB/1G3CCI36Zd8xy2HrFVACi8tfk5XrgLQEk+P0Tnz9UcA==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/@web/dev-server-rollup": { + "version": "0.3.15", + "resolved": "https://registry.npmjs.org/@web/dev-server-rollup/-/dev-server-rollup-0.3.15.tgz", + "integrity": "sha512-hhxvBmNIY19vXeocYB1IBOuhpVpy1L7jbwBarmvC0QJKZsgkxssNTzXJ8iga70c2+H0c/rBz1xUaKuAcov0uOA==", + "dependencies": { + "@rollup/plugin-node-resolve": "^11.0.1", + "@web/dev-server-core": "^0.3.16", + "nanocolors": "^0.2.1", + "parse5": "^6.0.1", + "rollup": "^2.66.1", + "whatwg-url": "^11.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@web/parse5-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@web/parse5-utils/-/parse5-utils-1.3.0.tgz", + "integrity": "sha512-Pgkx3ECc8EgXSlS5EyrgzSOoUbM6P8OKS471HLAyvOBcP1NCBn0to4RN/OaKASGq8qa3j+lPX9H14uA5AHEnQg==", + "dependencies": { + "@types/parse5": "^6.0.1", + "parse5": "^6.0.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@web/test-runner": { + "version": "0.13.26", + "resolved": "https://registry.npmjs.org/@web/test-runner/-/test-runner-0.13.26.tgz", + "integrity": "sha512-hiujl3GekUWbF/q1QJKDVcVWCB5zIbD05E+km2666SsP5+JCsnciDMm670TSaS4g8xoH/8WIJEyZnDVNQy/X6A==", + "dependencies": { + "@web/browser-logs": "^0.2.2", + "@web/config-loader": "^0.1.3", + "@web/dev-server": "^0.1.24", + "@web/test-runner-chrome": "^0.10.6", + "@web/test-runner-commands": "^0.6.0", + "@web/test-runner-core": "^0.10.22", + "@web/test-runner-mocha": "^0.7.5", + "camelcase": "^6.2.0", + "command-line-args": "^5.1.1", + "command-line-usage": "^6.1.1", + "convert-source-map": "^1.7.0", + "diff": "^5.0.0", + "globby": "^11.0.1", + "nanocolors": "^0.2.1", + "portfinder": "^1.0.28", + "source-map": "^0.7.3" + }, + "bin": { + "web-test-runner": "dist/bin.js", + "wtr": "dist/bin.js" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@web/test-runner-chrome": { + "version": "0.10.6", + "resolved": "https://registry.npmjs.org/@web/test-runner-chrome/-/test-runner-chrome-0.10.6.tgz", + "integrity": "sha512-oktBTPy1SLxbmwvC5dD3xnFvMnHwGwJ051SKBR1SPSR5wAXqyYQcsYEpcwk/jNrpZPXm1m+jJxk7SuPZflc+SQ==", + "dependencies": { + "@web/test-runner-core": "^0.10.20", + "@web/test-runner-coverage-v8": "^0.4.8", + "chrome-launcher": "^0.15.0", + "puppeteer-core": "^13.1.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@web/test-runner-commands": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@web/test-runner-commands/-/test-runner-commands-0.6.1.tgz", + "integrity": "sha512-P4aQqp0duumeGdGxQ8TwLnplkrXzpLqb47eSEEqBRS//C1H7s6VskaqEng+k0dbk+cSpEa4RuZGY/G5k8aTjTw==", + "dependencies": { + "@web/test-runner-core": "^0.10.20", + "mkdirp": "^1.0.4" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@web/test-runner-commands/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@web/test-runner-core": { + "version": "0.10.23", + "resolved": "https://registry.npmjs.org/@web/test-runner-core/-/test-runner-core-0.10.23.tgz", + "integrity": "sha512-02qig6GufCMdzGEXD1HT4uy1pxBhHeEZ0Yb4HqenbW2b2/8qPk983dYl1OmUwzFPPMIHcvCjpl9u5LxF464+Ng==", + "dependencies": { + "@babel/code-frame": "^7.12.11", + "@types/babel__code-frame": "^7.0.2", + "@types/co-body": "^6.1.0", + "@types/convert-source-map": "^1.5.1", + "@types/debounce": "^1.2.0", + "@types/istanbul-lib-coverage": "^2.0.3", + "@types/istanbul-reports": "^3.0.0", + "@web/browser-logs": "^0.2.1", + "@web/dev-server-core": "^0.3.16", + "chokidar": "^3.4.3", + "cli-cursor": "^3.1.0", + "co-body": "^6.1.0", + "convert-source-map": "^1.7.0", + "debounce": "^1.2.0", + "dependency-graph": "^0.11.0", + "globby": "^11.0.1", + "ip": "^1.1.5", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-reports": "^3.0.2", + "log-update": "^4.0.0", + "nanocolors": "^0.2.1", + "nanoid": "^3.1.25", + "open": "^8.0.2", + "picomatch": "^2.2.2", + "source-map": "^0.7.3" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@web/test-runner-coverage-v8": { + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/@web/test-runner-coverage-v8/-/test-runner-coverage-v8-0.4.8.tgz", + "integrity": "sha512-Ib0AscR8Xf9E/V7rf3XOVQTe4vKIbwSTupxV1xGgzj3x4RKUuMUg9FLz9EigZ5iN0mOzZKDllyRS523hbdhDtA==", + "dependencies": { + "@web/test-runner-core": "^0.10.20", + "istanbul-lib-coverage": "^3.0.0", + "picomatch": "^2.2.2", + "v8-to-istanbul": "^8.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@web/test-runner-mocha": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@web/test-runner-mocha/-/test-runner-mocha-0.7.5.tgz", + "integrity": "sha512-12/OBq6efPCAvJpcz3XJs2OO5nHe7GtBibZ8Il1a0QtsGpRmuJ4/m1EF0Fj9f6KHg7JdpGo18A37oE+5hXjHwg==", + "dependencies": { + "@types/mocha": "^8.2.0", + "@web/test-runner-core": "^0.10.20" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@web/test-runner-puppeteer": { + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/@web/test-runner-puppeteer/-/test-runner-puppeteer-0.10.5.tgz", + "integrity": "sha512-B+dn5wWMUwHZEm68o3f4WJEoqeApDxfKtNbLNbsVp7Mg2JUnoQkKpbOTi5uyU4YjWVIpP+CHkD5jJ9JWikGiNQ==", + "dependencies": { + "@web/test-runner-chrome": "^0.10.6", + "@web/test-runner-core": "^0.10.20", + "puppeteer": "^13.1.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/accepts": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "dependencies": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/array-back": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", + "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==", + "engines": { + "node": ">=6" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dependencies": { + "lodash": "^4.17.14" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bl/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "engines": { + "node": "*" + } + }, + "node_modules/builtin-modules": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", + "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/bytes": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz", + "integrity": "sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/cache-content-type": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-content-type/-/cache-content-type-1.0.1.tgz", + "integrity": "sha512-IKufZ1o4Ut42YUrZSo8+qnMTrFuKkvyoLXUywKz9GJ5BrhOFGhLdkx9sG4KAnVvbY6kEcSFjLQul+DVmBm2bgA==", + "dependencies": { + "mime-types": "^2.1.18", + "ylru": "^1.2.0" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, + "node_modules/chrome-launcher": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/chrome-launcher/-/chrome-launcher-0.15.0.tgz", + "integrity": "sha512-ZQqX5kb9H0+jy1OqLnWampfocrtSZaGl7Ny3F9GRha85o4odbL8x55paUzh51UC7cEmZ5obp3H2Mm70uC2PpRA==", + "dependencies": { + "@types/node": "*", + "escape-string-regexp": "^4.0.0", + "is-wsl": "^2.2.0", + "lighthouse-logger": "^1.0.0" + }, + "bin": { + "print-chrome-path": "bin/print-chrome-path.js" + }, + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/chrome-launcher/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/co-body": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/co-body/-/co-body-6.1.0.tgz", + "integrity": "sha512-m7pOT6CdLN7FuXUcpuz/8lfQ/L77x8SchHCF4G0RBTJO20Wzmhn5Sp4/5WsKy8OSpifBSUrmg83qEqaDHdyFuQ==", + "dependencies": { + "inflation": "^2.0.0", + "qs": "^6.5.2", + "raw-body": "^2.3.3", + "type-is": "^1.6.16" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "node_modules/command-line-args": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.0.tgz", + "integrity": "sha512-4zqtU1hYsSJzcJBOcNZIbW5Fbk9BkjCp1pZVhQKoRaWL5J7N4XphDLwo8aWwdQpTugxwu+jf9u2ZhkXiqp5Z6A==", + "dependencies": { + "array-back": "^3.1.0", + "find-replace": "^3.0.0", + "lodash.camelcase": "^4.3.0", + "typical": "^4.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/command-line-usage": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.1.tgz", + "integrity": "sha512-F59pEuAR9o1SF/bD0dQBDluhpT4jJQNWUHEuVBqpDmCUo6gPjCi+m9fCWnWZVR/oG6cMTUms4h+3NPl74wGXvA==", + "dependencies": { + "array-back": "^4.0.1", + "chalk": "^2.4.2", + "table-layout": "^1.0.1", + "typical": "^5.2.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/command-line-usage/node_modules/array-back": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", + "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/command-line-usage/node_modules/typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-disposition/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dependencies": { + "safe-buffer": "~5.1.1" + } + }, + "node_modules/cookies": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/cookies/-/cookies-0.8.0.tgz", + "integrity": "sha512-8aPsApQfebXnuI+537McwYsDtjVxGm8gTIzQI3FDW6t5t/DAhERxtnbEPN/8RX+uZthoz4eCOgloXaE5cYyNow==", + "dependencies": { + "depd": "~2.0.0", + "keygrip": "~1.1.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/debounce": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", + "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==" + }, + "node_modules/debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", + "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=" + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-lazy-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", + "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", + "engines": { + "node": ">=8" + } + }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dependency-graph": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.11.0.tgz", + "integrity": "sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/destroy": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.1.0.tgz", + "integrity": "sha512-R5QZrOXxSs0JDUIU/VANvRJlQVMts9C0L76HToQdPdlftfZCE7W6dyH0G4GZ5UW9fRqUOhAoCE2aGekuu+3HjQ==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/devtools-protocol": { + "version": "0.0.948846", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.948846.tgz", + "integrity": "sha512-5fGyt9xmMqUl2VI7+rnUkKCiAQIpLns8sfQtTENy5L70ktbNw0Z3TFJ1JoFNYdx/jffz4YXU45VF75wKZD7sZQ==" + }, + "node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/errorstacks": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/errorstacks/-/errorstacks-2.3.2.tgz", + "integrity": "sha512-cJp8qf5t2cXmVZJjZVrcU4ODFJeQOcUyjJEtPFtWO+3N6JPM6vCe4Sfv3cwIs/qS7gnUo/fvKX/mDCVQZq+P7A==" + }, + "node_modules/es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==" + }, + "node_modules/esbuild": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.14.tgz", + "integrity": "sha512-aiK4ddv+uui0k52OqSHu4xxu+SzOim7Rlz4i25pMEiC8rlnGU0HJ9r+ZMfdWL5bzifg+nhnn7x4NSWTeehYblg==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "optionalDependencies": { + "esbuild-android-arm64": "0.14.14", + "esbuild-darwin-64": "0.14.14", + "esbuild-darwin-arm64": "0.14.14", + "esbuild-freebsd-64": "0.14.14", + "esbuild-freebsd-arm64": "0.14.14", + "esbuild-linux-32": "0.14.14", + "esbuild-linux-64": "0.14.14", + "esbuild-linux-arm": "0.14.14", + "esbuild-linux-arm64": "0.14.14", + "esbuild-linux-mips64le": "0.14.14", + "esbuild-linux-ppc64le": "0.14.14", + "esbuild-linux-s390x": "0.14.14", + "esbuild-netbsd-64": "0.14.14", + "esbuild-openbsd-64": "0.14.14", + "esbuild-sunos-64": "0.14.14", + "esbuild-windows-32": "0.14.14", + "esbuild-windows-64": "0.14.14", + "esbuild-windows-arm64": "0.14.14" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.14.tgz", + "integrity": "sha512-be/Uw6DdpQiPfula1J4bdmA+wtZ6T3BRCZsDMFB5X+k0Gp8TIh9UvmAcqvKNnbRAafSaXG3jPCeXxDKqnc8hFQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/esbuild-darwin-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.14.tgz", + "integrity": "sha512-BEexYmjWafcISK8cT6O98E3TfcLuZL8DKuubry6G54n2+bD4GkoRD6HYUOnCkfl2p7jodA+s4369IjSFSWjtHg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.14.tgz", + "integrity": "sha512-tnBKm41pDOB1GtZ8q/w26gZlLLRzVmP8fdsduYjvM+yFD7E2DLG4KbPAqFMWm4Md9B+DitBglP57FY7AznxbTg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.14.tgz", + "integrity": "sha512-Q9Rx6sgArOHalQtNwAaIzJ6dnQ8A+I7f/RsQsdkS3JrdzmnlFo8JEVofTmwVQLoIop7OKUqIVOGP4PoQcwfVMA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.14.tgz", + "integrity": "sha512-TJvq0OpLM7BkTczlyPIphcvnwrQwQDG1HqxzoYePWn26SMUAlt6wrLnEvxdbXAvNvDLVzG83kA+JimjK7aRNBA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/esbuild-linux-32": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.14.tgz", + "integrity": "sha512-h/CrK9Baimt5VRbu8gqibWV7e1P9l+mkanQgyOgv0Ng3jHT1NVFC9e6rb1zbDdaJVmuhWX5xVliUA5bDDCcJeg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.14.tgz", + "integrity": "sha512-IC+wAiIg/egp5OhQp4W44D9PcBOH1b621iRn1OXmlLzij9a/6BGr9NMIL4CRwz4j2kp3WNZu5sT473tYdynOuQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-arm": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.14.tgz", + "integrity": "sha512-gxpOaHOPwp7zSmcKYsHrtxabScMqaTzfSQioAMUaB047YiMuDBzqVcKBG8OuESrYkGrL9DDljXr/mQNg7pbdaQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.14.tgz", + "integrity": "sha512-6QVul3RI4M5/VxVIRF/I5F+7BaxzR3DfNGoqEVSCZqUbgzHExPn+LXr5ly1C7af2Kw4AHpo+wDqx8A4ziP9avw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.14.tgz", + "integrity": "sha512-4Jl5/+xoINKbA4cesH3f4R+q0vltAztZ6Jm8YycS8lNhN1pgZJBDxWfI6HUMIAdkKlIpR1PIkA9aXQgZ8sxFAg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.14.tgz", + "integrity": "sha512-BitW37GxeebKxqYNl4SVuSdnIJAzH830Lr6Mkq3pBHXtzQay0vK+IeOR/Ele1GtNVJ+/f8wYM53tcThkv5SC5w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.14.tgz", + "integrity": "sha512-vLj6p76HOZG3wfuTr5MyO3qW5iu8YdhUNxuY+tx846rPo7GcKtYSPMusQjeVEfZlJpSYoR+yrNBBxq+qVF9zrw==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.14.tgz", + "integrity": "sha512-fn8looXPQhpVqUyCBWUuPjesH+yGIyfbIQrLKG05rr1Kgm3rZD/gaYrd3Wpmf5syVZx70pKZPvdHp8OTA+y7cQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ] + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.14.tgz", + "integrity": "sha512-HdAnJ399pPff3SKbd8g+P4o5znseni5u5n5rJ6Z7ouqOdgbOwHe2ofZbMow17WMdNtz1IyOZk2Wo9Ve6/lZ4Rg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/esbuild-sunos-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.14.tgz", + "integrity": "sha512-bmDHa99ulsGnYlh/xjBEfxoGuC8CEG5OWvlgD+pF7bKKiVTbtxqVCvOGEZeoDXB+ja6AvHIbPxrEE32J+m5nqQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ] + }, + "node_modules/esbuild-windows-32": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.14.tgz", + "integrity": "sha512-6tVooQcxJCNenPp5GHZBs/RLu31q4B+BuF4MEoRxswT+Eq2JGF0ZWDRQwNKB8QVIo3t6Svc5wNGez+CwKNQjBg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/esbuild-windows-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.14.tgz", + "integrity": "sha512-kl3BdPXh0/RD/dad41dtzj2itMUR4C6nQbXQCyYHHo4zoUoeIXhpCrSl7BAW1nv5EFL8stT1V+TQVXGZca5A2A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.14.tgz", + "integrity": "sha512-dCm1wTOm6HIisLanmybvRKvaXZZo4yEVrHh1dY0v582GThXJOzuXGja1HIQgV09RpSHYRL3m4KoUBL00l6SWEg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/extract-zip/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/fast-glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-replace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", + "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==", + "dependencies": { + "array-back": "^3.0.1" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "engines": { + "node": ">=4" + } + }, + "node_modules/has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==" + }, + "node_modules/http-assert": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/http-assert/-/http-assert-1.5.0.tgz", + "integrity": "sha512-uPpH7OKX4H25hBmU6G1jWNaqJGpTXxey+YOUizJUAgu0AjLUeC8D73hTrhvDS5D+GJN1DN1+hhc/eF/wpxtp0w==", + "dependencies": { + "deep-equal": "~1.0.1", + "http-errors": "~1.8.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/http-errors": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/http-errors/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/inflation": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/inflation/-/inflation-2.0.0.tgz", + "integrity": "sha1-i0F+R8KPklpFEz2RTKH9OJEH8w8=", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=" + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/isbinaryfile": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.8.tgz", + "integrity": "sha512-53h6XFniq77YdW+spoRrebh0mnmTxRPTlcuIArO57lmMdq4uBKFKaeTjnb92oYWrSn/LVL+LT+Hap2tFQj8V+w==", + "engines": { + "node": ">= 8.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/gjtorikian/" + } + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.3.tgz", + "integrity": "sha512-x9LtDVtfm/t1GFiLl3NffC7hz+I1ragvgX1P/Lg1NlIagifZDKUkuuaAxH/qpwj2IuEfD8G2Bs/UKp+sZ/pKkg==", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/keygrip": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/keygrip/-/keygrip-1.1.0.tgz", + "integrity": "sha512-iYSchDJ+liQ8iwbSI2QqsQOvqv58eJCEanyJPJi+Khyu8smkcKSFUCbPwzFcL7YVtZ6eONjqRX/38caJ7QjRAQ==", + "dependencies": { + "tsscmp": "1.0.6" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/koa": { + "version": "2.13.4", + "resolved": "https://registry.npmjs.org/koa/-/koa-2.13.4.tgz", + "integrity": "sha512-43zkIKubNbnrULWlHdN5h1g3SEKXOEzoAlRsHOTFpnlDu8JlAOZSMJBLULusuXRequboiwJcj5vtYXKB3k7+2g==", + "dependencies": { + "accepts": "^1.3.5", + "cache-content-type": "^1.0.0", + "content-disposition": "~0.5.2", + "content-type": "^1.0.4", + "cookies": "~0.8.0", + "debug": "^4.3.2", + "delegates": "^1.0.0", + "depd": "^2.0.0", + "destroy": "^1.0.4", + "encodeurl": "^1.0.2", + "escape-html": "^1.0.3", + "fresh": "~0.5.2", + "http-assert": "^1.3.0", + "http-errors": "^1.6.3", + "is-generator-function": "^1.0.7", + "koa-compose": "^4.1.0", + "koa-convert": "^2.0.0", + "on-finished": "^2.3.0", + "only": "~0.0.2", + "parseurl": "^1.3.2", + "statuses": "^1.5.0", + "type-is": "^1.6.16", + "vary": "^1.1.2" + }, + "engines": { + "node": "^4.8.4 || ^6.10.1 || ^7.10.1 || >= 8.1.4" + } + }, + "node_modules/koa-compose": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/koa-compose/-/koa-compose-4.1.0.tgz", + "integrity": "sha512-8ODW8TrDuMYvXRwra/Kh7/rJo9BtOfPc6qO8eAfC80CnCvSjSl0bkRM24X6/XBBEyj0v1nRUQ1LyOy3dbqOWXw==" + }, + "node_modules/koa-convert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/koa-convert/-/koa-convert-2.0.0.tgz", + "integrity": "sha512-asOvN6bFlSnxewce2e/DK3p4tltyfC4VM7ZwuTuepI7dEQVcvpyFuBcEARu1+Hxg8DIwytce2n7jrZtRlPrARA==", + "dependencies": { + "co": "^4.6.0", + "koa-compose": "^4.1.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/koa-etag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/koa-etag/-/koa-etag-4.0.0.tgz", + "integrity": "sha512-1cSdezCkBWlyuB9l6c/IFoe1ANCDdPBxkDkRiaIup40xpUub6U/wwRXoKBZw/O5BifX9OlqAjYnDyzM6+l+TAg==", + "dependencies": { + "etag": "^1.8.1" + } + }, + "node_modules/koa-send": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/koa-send/-/koa-send-5.0.1.tgz", + "integrity": "sha512-tmcyQ/wXXuxpDxyNXv5yNNkdAMdFRqwtegBXUaowiQzUKqJehttS0x2j0eOZDQAyloAth5w6wwBImnFzkUz3pQ==", + "dependencies": { + "debug": "^4.1.1", + "http-errors": "^1.7.3", + "resolve-path": "^1.4.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/koa-static": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/koa-static/-/koa-static-5.0.0.tgz", + "integrity": "sha512-UqyYyH5YEXaJrf9S8E23GoJFQZXkBVJ9zYYMPGz919MSX1KuvAcycIuS0ci150HCoPf4XQVhQ84Qf8xRPWxFaQ==", + "dependencies": { + "debug": "^3.1.0", + "koa-send": "^5.0.0" + }, + "engines": { + "node": ">= 7.6.0" + } + }, + "node_modules/koa-static/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/lighthouse-logger": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.3.0.tgz", + "integrity": "sha512-BbqAKApLb9ywUli+0a+PcV04SyJ/N1q/8qgCNe6U97KbPCS1BTksEuHFLYdvc8DltuhfxIUBqDZsC0bBGtl3lA==", + "dependencies": { + "debug": "^2.6.9", + "marky": "^1.2.2" + } + }, + "node_modules/lighthouse-logger/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/lighthouse-logger/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=" + }, + "node_modules/log-update": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", + "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "dependencies": { + "ansi-escapes": "^4.3.0", + "cli-cursor": "^3.1.0", + "slice-ansi": "^4.0.0", + "wrap-ansi": "^6.2.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/marky": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/marky/-/marky-1.2.2.tgz", + "integrity": "sha512-k1dB2HNeaNyORco8ulVEhctyEGkKHb2YWAhDsxeFlW2nROIirsctBYzKwwS3Vza+sKTS1zO4Z+n9/+9WbGLIxQ==" + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "dependencies": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime-db": { + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "dependencies": { + "mime-db": "1.51.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + }, + "node_modules/mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/nanocolors": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/nanocolors/-/nanocolors-0.2.13.tgz", + "integrity": "sha512-0n3mSAQLPpGLV9ORXT5+C/D4mwew7Ebws69Hx4E2sgz2ZA5+32Q80B9tL8PbL7XHnRDiAxH/pnrUJ9a4fkTNTA==" + }, + "node_modules/nanoid": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", + "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/negotiator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/only": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/only/-/only-0.0.2.tgz", + "integrity": "sha1-Kv3oTQPlC5qO3EROMGEKcCle37Q=" + }, + "node_modules/open": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz", + "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==", + "dependencies": { + "define-lazy-prop": "^2.0.0", + "is-docker": "^2.1.1", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/portfinder": { + "version": "1.0.28", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", + "integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==", + "dependencies": { + "async": "^2.6.2", + "debug": "^3.1.1", + "mkdirp": "^0.5.5" + }, + "engines": { + "node": ">= 0.12.0" + } + }, + "node_modules/portfinder/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "engines": { + "node": ">=6" + } + }, + "node_modules/puppeteer": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-13.1.2.tgz", + "integrity": "sha512-ozVM8Tdg0patMtm/xAr3Uh7rQ28vBpbTHLP+ECmoAxG/s4PKrVLN764H/poLux7Ln77jHThOd8OBJj5mTuA6Iw==", + "hasInstallScript": true, + "dependencies": { + "debug": "4.3.2", + "devtools-protocol": "0.0.948846", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.0", + "node-fetch": "2.6.7", + "pkg-dir": "4.2.0", + "progress": "2.0.3", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.2.3" + }, + "engines": { + "node": ">=10.18.1" + } + }, + "node_modules/puppeteer-core": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-13.1.2.tgz", + "integrity": "sha512-A60/BJkYKpvoWPN0sq0WbOUYey6Wqpn1vlWCt8Ov7PxGIjyuGX2Wb39LObGjOxh4UN+YxCVE+oYQlkIFSmHJtg==", + "dependencies": { + "debug": "4.3.2", + "devtools-protocol": "0.0.948846", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.0", + "node-fetch": "2.6.7", + "pkg-dir": "4.2.0", + "progress": "2.0.3", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.2.3" + }, + "engines": { + "node": ">=10.18.1" + } + }, + "node_modules/puppeteer-core/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/puppeteer/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/qs": { + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/raw-body": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz", + "integrity": "sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ==", + "dependencies": { + "bytes": "3.1.1", + "http-errors": "1.8.1", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/reduce-flatten": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz", + "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==", + "engines": { + "node": ">=6" + } + }, + "node_modules/resolve": { + "version": "1.21.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.1.tgz", + "integrity": "sha512-lfEImVbnolPuaSZuLQ52cAxPBHeI77sPwCOWRdy12UG/CNa8an7oBHH1R+Fp1/mUqSJi4c8TIP6FOIPSZAUrEQ==", + "dependencies": { + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-path": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/resolve-path/-/resolve-path-1.4.0.tgz", + "integrity": "sha1-xL2p9e+y/OZSR4c6s2u02DT+Fvc=", + "dependencies": { + "http-errors": "~1.6.2", + "path-is-absolute": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/resolve-path/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/resolve-path/node_modules/http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/resolve-path/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "node_modules/resolve-path/node_modules/setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "2.66.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.66.1.tgz", + "integrity": "sha512-crSgLhSkLMnKr4s9iZ/1qJCplgAgrRY+igWv8KhG/AjKOJ0YX/WpmANyn8oxrw+zenF3BXWDLa7Xl/QZISH+7w==", + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz", + "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==" + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/slice-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/table-layout": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.2.tgz", + "integrity": "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==", + "dependencies": { + "array-back": "^4.0.1", + "deep-extend": "~0.6.0", + "typical": "^5.2.0", + "wordwrapjs": "^4.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/table-layout/node_modules/array-back": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", + "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/table-layout/node_modules/typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tar-stream/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/ts-petstore-client": { + "resolved": "../../builds/browser", + "link": true + }, + "node_modules/tsscmp": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz", + "integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==", + "engines": { + "node": ">=0.6.x" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typescript": { + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", + "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/typical": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", + "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "node_modules/v8-to-istanbul": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz", + "integrity": "sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w==", + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0", + "source-map": "^0.7.3" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/wordwrapjs": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.1.tgz", + "integrity": "sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==", + "dependencies": { + "reduce-flatten": "^2.0.0", + "typical": "^5.2.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/wordwrapjs/node_modules/typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "node_modules/ws": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/ylru": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ylru/-/ylru-1.2.1.tgz", + "integrity": "sha512-faQrqNMzcPCHGVC2aaOINk13K+aaBDUPjGWl0teOXywElLjyVAB6Oe2jj62jHYtwsU49jXhScYbvPENK+6zAvQ==", + "engines": { + "node": ">= 4.0.0" + } + } + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "requires": { + "@babel/highlight": "^7.16.7" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==" + }, + "@babel/highlight": { + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz", + "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==", + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@esm-bundle/chai": { + "version": "4.3.4-fix.0", + "resolved": "https://registry.npmjs.org/@esm-bundle/chai/-/chai-4.3.4-fix.0.tgz", + "integrity": "sha512-26SKdM4uvDWlY8/OOOxSB1AqQWeBosCX3wRYUZO7enTAj03CtVxIiCimYVG2WpULcyV51qapK4qTovwkUr5Mlw==", + "requires": { + "@types/chai": "^4.2.12" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==" + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@rollup/plugin-node-resolve": { + "version": "11.2.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.2.1.tgz", + "integrity": "sha512-yc2n43jcqVyGE2sqV5/YCmocy9ArjVAP/BeXyTtADTBBX6V0e5UMqwO8CdQ0kzjb6zu5P1qMzsScCMRvE9OlVg==", + "requires": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "builtin-modules": "^3.1.0", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.19.0" + } + }, + "@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "requires": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + } + }, + "@types/accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==", + "requires": { + "@types/node": "*" + } + }, + "@types/babel__code-frame": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@types/babel__code-frame/-/babel__code-frame-7.0.3.tgz", + "integrity": "sha512-2TN6oiwtNjOezilFVl77zwdNPwQWaDBBCCWWxyo1ctiO3vAtd7H/aB/CBJdw9+kqq3+latD0SXoedIuHySSZWw==" + }, + "@types/body-parser": { + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", + "requires": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "@types/chai": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz", + "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==" + }, + "@types/co-body": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@types/co-body/-/co-body-6.1.0.tgz", + "integrity": "sha512-3e0q2jyDAnx/DSZi0z2H0yoZ2wt5yRDZ+P7ymcMObvq0ufWRT4tsajyO+Q1VwVWiv9PRR4W3YEjEzBjeZlhF+w==", + "requires": { + "@types/node": "*", + "@types/qs": "*" + } + }, + "@types/command-line-args": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@types/command-line-args/-/command-line-args-5.2.0.tgz", + "integrity": "sha512-UuKzKpJJ/Ief6ufIaIzr3A/0XnluX7RvFgwkV89Yzvm77wCh1kFaFmqN8XEnGcN62EuHdedQjEMb8mYxFLGPyA==" + }, + "@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "requires": { + "@types/node": "*" + } + }, + "@types/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-0mPF08jn9zYI0n0Q/Pnz7C4kThdSt+6LD4amsrYDDpgBfrVWa3TcCOxKX1zkGgYniGagRv8heN2cbh+CAn+uuQ==" + }, + "@types/convert-source-map": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@types/convert-source-map/-/convert-source-map-1.5.2.tgz", + "integrity": "sha512-tHs++ZeXer40kCF2JpE51Hg7t4HPa18B1b1Dzy96S0eCw8QKECNMYMfwa1edK/x8yCN0r4e6ewvLcc5CsVGkdg==" + }, + "@types/cookies": { + "version": "0.7.7", + "resolved": "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.7.tgz", + "integrity": "sha512-h7BcvPUogWbKCzBR2lY4oqaZbO3jXZksexYJVFvkrFeLgbZjQkU4x8pRq6eg2MHXQhY0McQdqmmsxRWlVAHooA==", + "requires": { + "@types/connect": "*", + "@types/express": "*", + "@types/keygrip": "*", + "@types/node": "*" + } + }, + "@types/debounce": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/debounce/-/debounce-1.2.1.tgz", + "integrity": "sha512-epMsEE85fi4lfmJUH/89/iV/LI+F5CvNIvmgs5g5jYFPfhO2S/ae8WSsLOKWdwtoaZw9Q2IhJ4tQ5tFCcS/4HA==" + }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==" + }, + "@types/express": { + "version": "4.17.13", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", + "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.18", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.17.28", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz", + "integrity": "sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig==", + "requires": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } + }, + "@types/http-assert": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.3.tgz", + "integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==" + }, + "@types/http-errors": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-1.8.2.tgz", + "integrity": "sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w==" + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==" + }, + "@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/keygrip": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz", + "integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==" + }, + "@types/koa": { + "version": "2.13.4", + "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.4.tgz", + "integrity": "sha512-dfHYMfU+z/vKtQB7NUrthdAEiSvnLebvBjwHtfFmpZmB7em2N3WVQdHgnFq+xvyVgxW5jKDmjWfLD3lw4g4uTw==", + "requires": { + "@types/accepts": "*", + "@types/content-disposition": "*", + "@types/cookies": "*", + "@types/http-assert": "*", + "@types/http-errors": "*", + "@types/keygrip": "*", + "@types/koa-compose": "*", + "@types/node": "*" + } + }, + "@types/koa-compose": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/@types/koa-compose/-/koa-compose-3.2.5.tgz", + "integrity": "sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==", + "requires": { + "@types/koa": "*" + } + }, + "@types/mime": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", + "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==" + }, + "@types/mocha": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.3.tgz", + "integrity": "sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw==" + }, + "@types/node": { + "version": "17.0.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.13.tgz", + "integrity": "sha512-Y86MAxASe25hNzlDbsviXl8jQHb0RDvKt4c40ZJQ1Don0AAL0STLZSs4N+6gLEO55pedy7r2cLwS+ZDxPm/2Bw==" + }, + "@types/parse5": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz", + "integrity": "sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==" + }, + "@types/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==" + }, + "@types/range-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", + "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==" + }, + "@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "requires": { + "@types/node": "*" + } + }, + "@types/serve-static": { + "version": "1.13.10", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz", + "integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==", + "requires": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "requires": { + "@types/node": "*" + } + }, + "@types/yauzl": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz", + "integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==", + "optional": true, + "requires": { + "@types/node": "*" + } + }, + "@web/browser-logs": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@web/browser-logs/-/browser-logs-0.2.5.tgz", + "integrity": "sha512-Qxo1wY/L7yILQqg0jjAaueh+tzdORXnZtxQgWH23SsTCunz9iq9FvsZa8Q5XlpjnZ3vLIsFEuEsCMqFeohJnEg==", + "requires": { + "errorstacks": "^2.2.0" + } + }, + "@web/config-loader": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@web/config-loader/-/config-loader-0.1.3.tgz", + "integrity": "sha512-XVKH79pk4d3EHRhofete8eAnqto1e8mCRAqPV00KLNFzCWSe8sWmLnqKCqkPNARC6nksMaGrATnA5sPDRllMpQ==", + "requires": { + "semver": "^7.3.4" + } + }, + "@web/dev-server": { + "version": "0.1.29", + "resolved": "https://registry.npmjs.org/@web/dev-server/-/dev-server-0.1.29.tgz", + "integrity": "sha512-oDz6vC9JEDZd4ZTno+SV57zCpsQl9v5LOkGuWGyei5gx5xu8NVDvh2IgTugz6DhZnffsSE6Zi0ubs+AhonLnGA==", + "requires": { + "@babel/code-frame": "^7.12.11", + "@types/command-line-args": "^5.0.0", + "@web/config-loader": "^0.1.3", + "@web/dev-server-core": "^0.3.17", + "@web/dev-server-rollup": "^0.3.13", + "camelcase": "^6.2.0", + "command-line-args": "^5.1.1", + "command-line-usage": "^6.1.1", + "debounce": "^1.2.0", + "deepmerge": "^4.2.2", + "ip": "^1.1.5", + "nanocolors": "^0.2.1", + "open": "^8.0.2", + "portfinder": "^1.0.28" + } + }, + "@web/dev-server-core": { + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@web/dev-server-core/-/dev-server-core-0.3.17.tgz", + "integrity": "sha512-vN1dwQ8yDHGiAvCeUo9xFfjo+pFl8TW+pON7k9kfhbegrrB8CKhJDUxmHbZsyQUmjf/iX57/LhuWj1xGhRL8AA==", + "requires": { + "@types/koa": "^2.11.6", + "@types/ws": "^7.4.0", + "@web/parse5-utils": "^1.2.0", + "chokidar": "^3.4.3", + "clone": "^2.1.2", + "es-module-lexer": "^0.9.0", + "get-stream": "^6.0.0", + "is-stream": "^2.0.0", + "isbinaryfile": "^4.0.6", + "koa": "^2.13.0", + "koa-etag": "^4.0.0", + "koa-send": "^5.0.1", + "koa-static": "^5.0.0", + "lru-cache": "^6.0.0", + "mime-types": "^2.1.27", + "parse5": "^6.0.1", + "picomatch": "^2.2.2", + "ws": "^7.4.2" + }, + "dependencies": { + "ws": { + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.6.tgz", + "integrity": "sha512-6GLgCqo2cy2A2rjCNFlxQS6ZljG/coZfZXclldI8FB/1G3CCI36Zd8xy2HrFVACi8tfk5XrgLQEk+P0Tnz9UcA==", + "requires": {} + } + } + }, + "@web/dev-server-rollup": { + "version": "0.3.15", + "resolved": "https://registry.npmjs.org/@web/dev-server-rollup/-/dev-server-rollup-0.3.15.tgz", + "integrity": "sha512-hhxvBmNIY19vXeocYB1IBOuhpVpy1L7jbwBarmvC0QJKZsgkxssNTzXJ8iga70c2+H0c/rBz1xUaKuAcov0uOA==", + "requires": { + "@rollup/plugin-node-resolve": "^11.0.1", + "@web/dev-server-core": "^0.3.16", + "nanocolors": "^0.2.1", + "parse5": "^6.0.1", + "rollup": "^2.66.1", + "whatwg-url": "^11.0.0" + } + }, + "@web/parse5-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@web/parse5-utils/-/parse5-utils-1.3.0.tgz", + "integrity": "sha512-Pgkx3ECc8EgXSlS5EyrgzSOoUbM6P8OKS471HLAyvOBcP1NCBn0to4RN/OaKASGq8qa3j+lPX9H14uA5AHEnQg==", + "requires": { + "@types/parse5": "^6.0.1", + "parse5": "^6.0.1" + } + }, + "@web/test-runner": { + "version": "0.13.26", + "resolved": "https://registry.npmjs.org/@web/test-runner/-/test-runner-0.13.26.tgz", + "integrity": "sha512-hiujl3GekUWbF/q1QJKDVcVWCB5zIbD05E+km2666SsP5+JCsnciDMm670TSaS4g8xoH/8WIJEyZnDVNQy/X6A==", + "requires": { + "@web/browser-logs": "^0.2.2", + "@web/config-loader": "^0.1.3", + "@web/dev-server": "^0.1.24", + "@web/test-runner-chrome": "^0.10.6", + "@web/test-runner-commands": "^0.6.0", + "@web/test-runner-core": "^0.10.22", + "@web/test-runner-mocha": "^0.7.5", + "camelcase": "^6.2.0", + "command-line-args": "^5.1.1", + "command-line-usage": "^6.1.1", + "convert-source-map": "^1.7.0", + "diff": "^5.0.0", + "globby": "^11.0.1", + "nanocolors": "^0.2.1", + "portfinder": "^1.0.28", + "source-map": "^0.7.3" + } + }, + "@web/test-runner-chrome": { + "version": "0.10.6", + "resolved": "https://registry.npmjs.org/@web/test-runner-chrome/-/test-runner-chrome-0.10.6.tgz", + "integrity": "sha512-oktBTPy1SLxbmwvC5dD3xnFvMnHwGwJ051SKBR1SPSR5wAXqyYQcsYEpcwk/jNrpZPXm1m+jJxk7SuPZflc+SQ==", + "requires": { + "@web/test-runner-core": "^0.10.20", + "@web/test-runner-coverage-v8": "^0.4.8", + "chrome-launcher": "^0.15.0", + "puppeteer-core": "^13.1.2" + } + }, + "@web/test-runner-commands": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@web/test-runner-commands/-/test-runner-commands-0.6.1.tgz", + "integrity": "sha512-P4aQqp0duumeGdGxQ8TwLnplkrXzpLqb47eSEEqBRS//C1H7s6VskaqEng+k0dbk+cSpEa4RuZGY/G5k8aTjTw==", + "requires": { + "@web/test-runner-core": "^0.10.20", + "mkdirp": "^1.0.4" + }, + "dependencies": { + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + } + } + }, + "@web/test-runner-core": { + "version": "0.10.23", + "resolved": "https://registry.npmjs.org/@web/test-runner-core/-/test-runner-core-0.10.23.tgz", + "integrity": "sha512-02qig6GufCMdzGEXD1HT4uy1pxBhHeEZ0Yb4HqenbW2b2/8qPk983dYl1OmUwzFPPMIHcvCjpl9u5LxF464+Ng==", + "requires": { + "@babel/code-frame": "^7.12.11", + "@types/babel__code-frame": "^7.0.2", + "@types/co-body": "^6.1.0", + "@types/convert-source-map": "^1.5.1", + "@types/debounce": "^1.2.0", + "@types/istanbul-lib-coverage": "^2.0.3", + "@types/istanbul-reports": "^3.0.0", + "@web/browser-logs": "^0.2.1", + "@web/dev-server-core": "^0.3.16", + "chokidar": "^3.4.3", + "cli-cursor": "^3.1.0", + "co-body": "^6.1.0", + "convert-source-map": "^1.7.0", + "debounce": "^1.2.0", + "dependency-graph": "^0.11.0", + "globby": "^11.0.1", + "ip": "^1.1.5", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-reports": "^3.0.2", + "log-update": "^4.0.0", + "nanocolors": "^0.2.1", + "nanoid": "^3.1.25", + "open": "^8.0.2", + "picomatch": "^2.2.2", + "source-map": "^0.7.3" + } + }, + "@web/test-runner-coverage-v8": { + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/@web/test-runner-coverage-v8/-/test-runner-coverage-v8-0.4.8.tgz", + "integrity": "sha512-Ib0AscR8Xf9E/V7rf3XOVQTe4vKIbwSTupxV1xGgzj3x4RKUuMUg9FLz9EigZ5iN0mOzZKDllyRS523hbdhDtA==", + "requires": { + "@web/test-runner-core": "^0.10.20", + "istanbul-lib-coverage": "^3.0.0", + "picomatch": "^2.2.2", + "v8-to-istanbul": "^8.0.0" + } + }, + "@web/test-runner-mocha": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@web/test-runner-mocha/-/test-runner-mocha-0.7.5.tgz", + "integrity": "sha512-12/OBq6efPCAvJpcz3XJs2OO5nHe7GtBibZ8Il1a0QtsGpRmuJ4/m1EF0Fj9f6KHg7JdpGo18A37oE+5hXjHwg==", + "requires": { + "@types/mocha": "^8.2.0", + "@web/test-runner-core": "^0.10.20" + } + }, + "@web/test-runner-puppeteer": { + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/@web/test-runner-puppeteer/-/test-runner-puppeteer-0.10.5.tgz", + "integrity": "sha512-B+dn5wWMUwHZEm68o3f4WJEoqeApDxfKtNbLNbsVp7Mg2JUnoQkKpbOTi5uyU4YjWVIpP+CHkD5jJ9JWikGiNQ==", + "requires": { + "@web/test-runner-chrome": "^0.10.6", + "@web/test-runner-core": "^0.10.20", + "puppeteer": "^13.1.2" + } + }, + "accepts": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "requires": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + } + }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + } + }, + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "requires": { + "type-fest": "^0.21.3" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "array-back": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", + "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==" + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" + }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==" + }, + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "requires": { + "lodash": "^4.17.14" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" + }, + "bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" + }, + "builtin-modules": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", + "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==" + }, + "bytes": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz", + "integrity": "sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg==" + }, + "cache-content-type": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-content-type/-/cache-content-type-1.0.1.tgz", + "integrity": "sha512-IKufZ1o4Ut42YUrZSo8+qnMTrFuKkvyoLXUywKz9GJ5BrhOFGhLdkx9sG4KAnVvbY6kEcSFjLQul+DVmBm2bgA==", + "requires": { + "mime-types": "^2.1.18", + "ylru": "^1.2.0" + } + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==" + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, + "chrome-launcher": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/chrome-launcher/-/chrome-launcher-0.15.0.tgz", + "integrity": "sha512-ZQqX5kb9H0+jy1OqLnWampfocrtSZaGl7Ny3F9GRha85o4odbL8x55paUzh51UC7cEmZ5obp3H2Mm70uC2PpRA==", + "requires": { + "@types/node": "*", + "escape-string-regexp": "^4.0.0", + "is-wsl": "^2.2.0", + "lighthouse-logger": "^1.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" + } + } + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "co-body": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/co-body/-/co-body-6.1.0.tgz", + "integrity": "sha512-m7pOT6CdLN7FuXUcpuz/8lfQ/L77x8SchHCF4G0RBTJO20Wzmhn5Sp4/5WsKy8OSpifBSUrmg83qEqaDHdyFuQ==", + "requires": { + "inflation": "^2.0.0", + "qs": "^6.5.2", + "raw-body": "^2.3.3", + "type-is": "^1.6.16" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "command-line-args": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.0.tgz", + "integrity": "sha512-4zqtU1hYsSJzcJBOcNZIbW5Fbk9BkjCp1pZVhQKoRaWL5J7N4XphDLwo8aWwdQpTugxwu+jf9u2ZhkXiqp5Z6A==", + "requires": { + "array-back": "^3.1.0", + "find-replace": "^3.0.0", + "lodash.camelcase": "^4.3.0", + "typical": "^4.0.0" + } + }, + "command-line-usage": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.1.tgz", + "integrity": "sha512-F59pEuAR9o1SF/bD0dQBDluhpT4jJQNWUHEuVBqpDmCUo6gPjCi+m9fCWnWZVR/oG6cMTUms4h+3NPl74wGXvA==", + "requires": { + "array-back": "^4.0.1", + "chalk": "^2.4.2", + "table-layout": "^1.0.1", + "typical": "^5.2.0" + }, + "dependencies": { + "array-back": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", + "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==" + }, + "typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==" + } + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "requires": { + "safe-buffer": "5.2.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + } + } + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "cookies": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/cookies/-/cookies-0.8.0.tgz", + "integrity": "sha512-8aPsApQfebXnuI+537McwYsDtjVxGm8gTIzQI3FDW6t5t/DAhERxtnbEPN/8RX+uZthoz4eCOgloXaE5cYyNow==", + "requires": { + "depd": "~2.0.0", + "keygrip": "~1.1.0" + } + }, + "debounce": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", + "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==" + }, + "debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "requires": { + "ms": "2.1.2" + } + }, + "deep-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", + "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=" + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" + }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==" + }, + "define-lazy-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", + "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==" + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + }, + "depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" + }, + "dependency-graph": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.11.0.tgz", + "integrity": "sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==" + }, + "destroy": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.1.0.tgz", + "integrity": "sha512-R5QZrOXxSs0JDUIU/VANvRJlQVMts9C0L76HToQdPdlftfZCE7W6dyH0G4GZ5UW9fRqUOhAoCE2aGekuu+3HjQ==" + }, + "devtools-protocol": { + "version": "0.0.948846", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.948846.tgz", + "integrity": "sha512-5fGyt9xmMqUl2VI7+rnUkKCiAQIpLns8sfQtTENy5L70ktbNw0Z3TFJ1JoFNYdx/jffz4YXU45VF75wKZD7sZQ==" + }, + "diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==" + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "requires": { + "path-type": "^4.0.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "errorstacks": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/errorstacks/-/errorstacks-2.3.2.tgz", + "integrity": "sha512-cJp8qf5t2cXmVZJjZVrcU4ODFJeQOcUyjJEtPFtWO+3N6JPM6vCe4Sfv3cwIs/qS7gnUo/fvKX/mDCVQZq+P7A==" + }, + "es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==" + }, + "esbuild": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.14.tgz", + "integrity": "sha512-aiK4ddv+uui0k52OqSHu4xxu+SzOim7Rlz4i25pMEiC8rlnGU0HJ9r+ZMfdWL5bzifg+nhnn7x4NSWTeehYblg==", + "dev": true, + "requires": { + "esbuild-android-arm64": "0.14.14", + "esbuild-darwin-64": "0.14.14", + "esbuild-darwin-arm64": "0.14.14", + "esbuild-freebsd-64": "0.14.14", + "esbuild-freebsd-arm64": "0.14.14", + "esbuild-linux-32": "0.14.14", + "esbuild-linux-64": "0.14.14", + "esbuild-linux-arm": "0.14.14", + "esbuild-linux-arm64": "0.14.14", + "esbuild-linux-mips64le": "0.14.14", + "esbuild-linux-ppc64le": "0.14.14", + "esbuild-linux-s390x": "0.14.14", + "esbuild-netbsd-64": "0.14.14", + "esbuild-openbsd-64": "0.14.14", + "esbuild-sunos-64": "0.14.14", + "esbuild-windows-32": "0.14.14", + "esbuild-windows-64": "0.14.14", + "esbuild-windows-arm64": "0.14.14" + } + }, + "esbuild-android-arm64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.14.tgz", + "integrity": "sha512-be/Uw6DdpQiPfula1J4bdmA+wtZ6T3BRCZsDMFB5X+k0Gp8TIh9UvmAcqvKNnbRAafSaXG3jPCeXxDKqnc8hFQ==", + "dev": true, + "optional": true + }, + "esbuild-darwin-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.14.tgz", + "integrity": "sha512-BEexYmjWafcISK8cT6O98E3TfcLuZL8DKuubry6G54n2+bD4GkoRD6HYUOnCkfl2p7jodA+s4369IjSFSWjtHg==", + "dev": true, + "optional": true + }, + "esbuild-darwin-arm64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.14.tgz", + "integrity": "sha512-tnBKm41pDOB1GtZ8q/w26gZlLLRzVmP8fdsduYjvM+yFD7E2DLG4KbPAqFMWm4Md9B+DitBglP57FY7AznxbTg==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.14.tgz", + "integrity": "sha512-Q9Rx6sgArOHalQtNwAaIzJ6dnQ8A+I7f/RsQsdkS3JrdzmnlFo8JEVofTmwVQLoIop7OKUqIVOGP4PoQcwfVMA==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-arm64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.14.tgz", + "integrity": "sha512-TJvq0OpLM7BkTczlyPIphcvnwrQwQDG1HqxzoYePWn26SMUAlt6wrLnEvxdbXAvNvDLVzG83kA+JimjK7aRNBA==", + "dev": true, + "optional": true + }, + "esbuild-linux-32": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.14.tgz", + "integrity": "sha512-h/CrK9Baimt5VRbu8gqibWV7e1P9l+mkanQgyOgv0Ng3jHT1NVFC9e6rb1zbDdaJVmuhWX5xVliUA5bDDCcJeg==", + "dev": true, + "optional": true + }, + "esbuild-linux-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.14.tgz", + "integrity": "sha512-IC+wAiIg/egp5OhQp4W44D9PcBOH1b621iRn1OXmlLzij9a/6BGr9NMIL4CRwz4j2kp3WNZu5sT473tYdynOuQ==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.14.tgz", + "integrity": "sha512-gxpOaHOPwp7zSmcKYsHrtxabScMqaTzfSQioAMUaB047YiMuDBzqVcKBG8OuESrYkGrL9DDljXr/mQNg7pbdaQ==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.14.tgz", + "integrity": "sha512-6QVul3RI4M5/VxVIRF/I5F+7BaxzR3DfNGoqEVSCZqUbgzHExPn+LXr5ly1C7af2Kw4AHpo+wDqx8A4ziP9avw==", + "dev": true, + "optional": true + }, + "esbuild-linux-mips64le": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.14.tgz", + "integrity": "sha512-4Jl5/+xoINKbA4cesH3f4R+q0vltAztZ6Jm8YycS8lNhN1pgZJBDxWfI6HUMIAdkKlIpR1PIkA9aXQgZ8sxFAg==", + "dev": true, + "optional": true + }, + "esbuild-linux-ppc64le": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.14.tgz", + "integrity": "sha512-BitW37GxeebKxqYNl4SVuSdnIJAzH830Lr6Mkq3pBHXtzQay0vK+IeOR/Ele1GtNVJ+/f8wYM53tcThkv5SC5w==", + "dev": true, + "optional": true + }, + "esbuild-linux-s390x": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.14.tgz", + "integrity": "sha512-vLj6p76HOZG3wfuTr5MyO3qW5iu8YdhUNxuY+tx846rPo7GcKtYSPMusQjeVEfZlJpSYoR+yrNBBxq+qVF9zrw==", + "dev": true, + "optional": true + }, + "esbuild-netbsd-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.14.tgz", + "integrity": "sha512-fn8looXPQhpVqUyCBWUuPjesH+yGIyfbIQrLKG05rr1Kgm3rZD/gaYrd3Wpmf5syVZx70pKZPvdHp8OTA+y7cQ==", + "dev": true, + "optional": true + }, + "esbuild-openbsd-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.14.tgz", + "integrity": "sha512-HdAnJ399pPff3SKbd8g+P4o5znseni5u5n5rJ6Z7ouqOdgbOwHe2ofZbMow17WMdNtz1IyOZk2Wo9Ve6/lZ4Rg==", + "dev": true, + "optional": true + }, + "esbuild-sunos-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.14.tgz", + "integrity": "sha512-bmDHa99ulsGnYlh/xjBEfxoGuC8CEG5OWvlgD+pF7bKKiVTbtxqVCvOGEZeoDXB+ja6AvHIbPxrEE32J+m5nqQ==", + "dev": true, + "optional": true + }, + "esbuild-windows-32": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.14.tgz", + "integrity": "sha512-6tVooQcxJCNenPp5GHZBs/RLu31q4B+BuF4MEoRxswT+Eq2JGF0ZWDRQwNKB8QVIo3t6Svc5wNGez+CwKNQjBg==", + "dev": true, + "optional": true + }, + "esbuild-windows-64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.14.tgz", + "integrity": "sha512-kl3BdPXh0/RD/dad41dtzj2itMUR4C6nQbXQCyYHHo4zoUoeIXhpCrSl7BAW1nv5EFL8stT1V+TQVXGZca5A2A==", + "dev": true, + "optional": true + }, + "esbuild-windows-arm64": { + "version": "0.14.14", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.14.tgz", + "integrity": "sha512-dCm1wTOm6HIisLanmybvRKvaXZZo4yEVrHh1dY0v582GThXJOzuXGja1HIQgV09RpSHYRL3m4KoUBL00l6SWEg==", + "dev": true, + "optional": true + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "requires": { + "@types/yauzl": "^2.9.1", + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } + } + } + }, + "fast-glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "requires": { + "reusify": "^1.0.4" + } + }, + "fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "requires": { + "pend": "~1.2.0" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-replace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", + "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==", + "requires": { + "array-back": "^3.0.1" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" + }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "requires": { + "is-glob": "^4.0.1" + } + }, + "globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "requires": { + "has-symbols": "^1.0.2" + } + }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==" + }, + "http-assert": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/http-assert/-/http-assert-1.5.0.tgz", + "integrity": "sha512-uPpH7OKX4H25hBmU6G1jWNaqJGpTXxey+YOUizJUAgu0AjLUeC8D73hTrhvDS5D+GJN1DN1+hhc/eF/wpxtp0w==", + "requires": { + "deep-equal": "~1.0.1", + "http-errors": "~1.8.0" + } + }, + "http-errors": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + }, + "dependencies": { + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + } + } + }, + "https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==" + }, + "inflation": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/inflation/-/inflation-2.0.0.tgz", + "integrity": "sha1-i0F+R8KPklpFEz2RTKH9OJEH8w8=" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-core-module": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "requires": { + "has": "^1.0.3" + } + }, + "is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=" + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + }, + "is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "requires": { + "is-docker": "^2.0.0" + } + }, + "isbinaryfile": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.8.tgz", + "integrity": "sha512-53h6XFniq77YdW+spoRrebh0mnmTxRPTlcuIArO57lmMdq4uBKFKaeTjnb92oYWrSn/LVL+LT+Hap2tFQj8V+w==" + }, + "istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==" + }, + "istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "istanbul-reports": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.3.tgz", + "integrity": "sha512-x9LtDVtfm/t1GFiLl3NffC7hz+I1ragvgX1P/Lg1NlIagifZDKUkuuaAxH/qpwj2IuEfD8G2Bs/UKp+sZ/pKkg==", + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "keygrip": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/keygrip/-/keygrip-1.1.0.tgz", + "integrity": "sha512-iYSchDJ+liQ8iwbSI2QqsQOvqv58eJCEanyJPJi+Khyu8smkcKSFUCbPwzFcL7YVtZ6eONjqRX/38caJ7QjRAQ==", + "requires": { + "tsscmp": "1.0.6" + } + }, + "koa": { + "version": "2.13.4", + "resolved": "https://registry.npmjs.org/koa/-/koa-2.13.4.tgz", + "integrity": "sha512-43zkIKubNbnrULWlHdN5h1g3SEKXOEzoAlRsHOTFpnlDu8JlAOZSMJBLULusuXRequboiwJcj5vtYXKB3k7+2g==", + "requires": { + "accepts": "^1.3.5", + "cache-content-type": "^1.0.0", + "content-disposition": "~0.5.2", + "content-type": "^1.0.4", + "cookies": "~0.8.0", + "debug": "^4.3.2", + "delegates": "^1.0.0", + "depd": "^2.0.0", + "destroy": "^1.0.4", + "encodeurl": "^1.0.2", + "escape-html": "^1.0.3", + "fresh": "~0.5.2", + "http-assert": "^1.3.0", + "http-errors": "^1.6.3", + "is-generator-function": "^1.0.7", + "koa-compose": "^4.1.0", + "koa-convert": "^2.0.0", + "on-finished": "^2.3.0", + "only": "~0.0.2", + "parseurl": "^1.3.2", + "statuses": "^1.5.0", + "type-is": "^1.6.16", + "vary": "^1.1.2" + } + }, + "koa-compose": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/koa-compose/-/koa-compose-4.1.0.tgz", + "integrity": "sha512-8ODW8TrDuMYvXRwra/Kh7/rJo9BtOfPc6qO8eAfC80CnCvSjSl0bkRM24X6/XBBEyj0v1nRUQ1LyOy3dbqOWXw==" + }, + "koa-convert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/koa-convert/-/koa-convert-2.0.0.tgz", + "integrity": "sha512-asOvN6bFlSnxewce2e/DK3p4tltyfC4VM7ZwuTuepI7dEQVcvpyFuBcEARu1+Hxg8DIwytce2n7jrZtRlPrARA==", + "requires": { + "co": "^4.6.0", + "koa-compose": "^4.1.0" + } + }, + "koa-etag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/koa-etag/-/koa-etag-4.0.0.tgz", + "integrity": "sha512-1cSdezCkBWlyuB9l6c/IFoe1ANCDdPBxkDkRiaIup40xpUub6U/wwRXoKBZw/O5BifX9OlqAjYnDyzM6+l+TAg==", + "requires": { + "etag": "^1.8.1" + } + }, + "koa-send": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/koa-send/-/koa-send-5.0.1.tgz", + "integrity": "sha512-tmcyQ/wXXuxpDxyNXv5yNNkdAMdFRqwtegBXUaowiQzUKqJehttS0x2j0eOZDQAyloAth5w6wwBImnFzkUz3pQ==", + "requires": { + "debug": "^4.1.1", + "http-errors": "^1.7.3", + "resolve-path": "^1.4.0" + } + }, + "koa-static": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/koa-static/-/koa-static-5.0.0.tgz", + "integrity": "sha512-UqyYyH5YEXaJrf9S8E23GoJFQZXkBVJ9zYYMPGz919MSX1KuvAcycIuS0ci150HCoPf4XQVhQ84Qf8xRPWxFaQ==", + "requires": { + "debug": "^3.1.0", + "koa-send": "^5.0.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "lighthouse-logger": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.3.0.tgz", + "integrity": "sha512-BbqAKApLb9ywUli+0a+PcV04SyJ/N1q/8qgCNe6U97KbPCS1BTksEuHFLYdvc8DltuhfxIUBqDZsC0bBGtl3lA==", + "requires": { + "debug": "^2.6.9", + "marky": "^1.2.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=" + }, + "log-update": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", + "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "requires": { + "ansi-escapes": "^4.3.0", + "cli-cursor": "^3.1.0", + "slice-ansi": "^4.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } + } + }, + "marky": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/marky/-/marky-1.2.2.tgz", + "integrity": "sha512-k1dB2HNeaNyORco8ulVEhctyEGkKHb2YWAhDsxeFlW2nROIirsctBYzKwwS3Vza+sKTS1zO4Z+n9/+9WbGLIxQ==" + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" + }, + "micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + } + }, + "mime-db": { + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==" + }, + "mime-types": { + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "requires": { + "mime-db": "1.51.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "requires": { + "minimist": "^1.2.5" + } + }, + "mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "nanocolors": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/nanocolors/-/nanocolors-0.2.13.tgz", + "integrity": "sha512-0n3mSAQLPpGLV9ORXT5+C/D4mwew7Ebws69Hx4E2sgz2ZA5+32Q80B9tL8PbL7XHnRDiAxH/pnrUJ9a4fkTNTA==" + }, + "nanoid": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", + "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==" + }, + "negotiator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" + }, + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "requires": { + "whatwg-url": "^5.0.0" + }, + "dependencies": { + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + } + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + }, + "object-inspect": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "only": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/only/-/only-0.0.2.tgz", + "integrity": "sha1-Kv3oTQPlC5qO3EROMGEKcCle37Q=" + }, + "open": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz", + "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==", + "requires": { + "define-lazy-prop": "^2.0.0", + "is-docker": "^2.1.1", + "is-wsl": "^2.2.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" + }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "requires": { + "find-up": "^4.0.0" + } + }, + "portfinder": { + "version": "1.0.28", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", + "integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==", + "requires": { + "async": "^2.6.2", + "debug": "^3.1.1", + "mkdirp": "^0.5.5" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" + }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "puppeteer": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-13.1.2.tgz", + "integrity": "sha512-ozVM8Tdg0patMtm/xAr3Uh7rQ28vBpbTHLP+ECmoAxG/s4PKrVLN764H/poLux7Ln77jHThOd8OBJj5mTuA6Iw==", + "requires": { + "debug": "4.3.2", + "devtools-protocol": "0.0.948846", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.0", + "node-fetch": "2.6.7", + "pkg-dir": "4.2.0", + "progress": "2.0.3", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.2.3" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "requires": { + "ms": "2.1.2" + } + } + } + }, + "puppeteer-core": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-13.1.2.tgz", + "integrity": "sha512-A60/BJkYKpvoWPN0sq0WbOUYey6Wqpn1vlWCt8Ov7PxGIjyuGX2Wb39LObGjOxh4UN+YxCVE+oYQlkIFSmHJtg==", + "requires": { + "debug": "4.3.2", + "devtools-protocol": "0.0.948846", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.0", + "node-fetch": "2.6.7", + "pkg-dir": "4.2.0", + "progress": "2.0.3", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.2.3" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "requires": { + "ms": "2.1.2" + } + } + } + }, + "qs": { + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "requires": { + "side-channel": "^1.0.4" + } + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "raw-body": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz", + "integrity": "sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ==", + "requires": { + "bytes": "3.1.1", + "http-errors": "1.8.1", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "requires": { + "picomatch": "^2.2.1" + } + }, + "reduce-flatten": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz", + "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==" + }, + "resolve": { + "version": "1.21.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.1.tgz", + "integrity": "sha512-lfEImVbnolPuaSZuLQ52cAxPBHeI77sPwCOWRdy12UG/CNa8an7oBHH1R+Fp1/mUqSJi4c8TIP6FOIPSZAUrEQ==", + "requires": { + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-path": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/resolve-path/-/resolve-path-1.4.0.tgz", + "integrity": "sha1-xL2p9e+y/OZSR4c6s2u02DT+Fvc=", + "requires": { + "http-errors": "~1.6.2", + "path-is-absolute": "1.0.1" + }, + "dependencies": { + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + } + } + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "requires": { + "glob": "^7.1.3" + } + }, + "rollup": { + "version": "2.66.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.66.1.tgz", + "integrity": "sha512-crSgLhSkLMnKr4s9iZ/1qJCplgAgrRY+igWv8KhG/AjKOJ0YX/WpmANyn8oxrw+zenF3BXWDLa7Xl/QZISH+7w==", + "requires": { + "fsevents": "~2.3.2" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "requires": { + "lru-cache": "^6.0.0" + } + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "signal-exit": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz", + "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==" + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + } + } + }, + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==" + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" + }, + "table-layout": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.2.tgz", + "integrity": "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==", + "requires": { + "array-back": "^4.0.1", + "deep-extend": "~0.6.0", + "typical": "^5.2.0", + "wordwrapjs": "^4.0.0" + }, + "dependencies": { + "array-back": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", + "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==" + }, + "typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==" + } + } + }, + "tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "requires": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" + }, + "tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "requires": { + "punycode": "^2.1.1" + } + }, + "ts-petstore-client": { + "version": "file:../../builds/browser", + "requires": { + "@types/url-parse": "1.4.4", + "es6-promise": "^4.2.4", + "typescript": "^3.9.3", + "url-parse": "^1.4.3", + "whatwg-fetch": "^3.0.0" + } + }, + "tsscmp": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz", + "integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==" + }, + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==" + }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "typescript": { + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", + "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "dev": true + }, + "typical": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", + "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==" + }, + "unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "requires": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "v8-to-istanbul": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz", + "integrity": "sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w==", + "requires": { + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0", + "source-map": "^0.7.3" + } + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==" + }, + "whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "requires": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + } + }, + "wordwrapjs": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.1.tgz", + "integrity": "sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==", + "requires": { + "reduce-flatten": "^2.0.0", + "typical": "^5.2.0" + }, + "dependencies": { + "typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==" + } + } + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", + "requires": {} + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "requires": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "ylru": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ylru/-/ylru-1.2.1.tgz", + "integrity": "sha512-faQrqNMzcPCHGVC2aaOINk13K+aaBDUPjGWl0teOXywElLjyVAB6Oe2jj62jHYtwsU49jXhScYbvPENK+6zAvQ==" + } + } +} diff --git a/samples/openapi3/client/petstore/typescript/tests/browser/package.json b/samples/openapi3/client/petstore/typescript/tests/browser/package.json new file mode 100644 index 000000000000..6c8368054307 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/tests/browser/package.json @@ -0,0 +1,20 @@ +{ + "name": "typescript-test", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "build": "tsc --noEmit && esbuild test/*.ts --bundle --outdir=dist", + "test": "web-test-runner" + }, + "dependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@web/test-runner": "^0.13.26", + "@web/test-runner-puppeteer": "^0.10.5", + "ts-petstore-client": "file:../../builds/browser" + }, + "devDependencies": { + "esbuild": "^0.14.14", + "typescript": "^4.4.4" + } +} diff --git a/samples/openapi3/client/petstore/typescript/tests/browser/pom.xml b/samples/openapi3/client/petstore/typescript/tests/browser/pom.xml new file mode 100644 index 000000000000..01114b494ee2 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/tests/browser/pom.xml @@ -0,0 +1,73 @@ + + 4.0.0 + org.openapitools + TypeScriptBrowserPetstoreClientTests + pom + 1.0-SNAPSHOT + TS Browser Petstore Test Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + npm-install + pre-integration-test + + exec + + + npm + + install + + + + + npm-build + pre-integration-test + + exec + + + npm + + run + build + + + + + npm-test + integration-test + + exec + + + npm + + test + + + + + + + + diff --git a/samples/openapi3/client/petstore/typescript/tests/browser/test/PetApi.test.ts b/samples/openapi3/client/petstore/typescript/tests/browser/test/PetApi.test.ts new file mode 100644 index 000000000000..78d07519cbe4 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/tests/browser/test/PetApi.test.ts @@ -0,0 +1,131 @@ +import { expect } from '@esm-bundle/chai'; +import { ServerConfiguration, createConfiguration, PetApi, Tag, Pet, ApiException, RequiredError } from 'ts-petstore-client' +import image from "./pet"; + +const configuration = createConfiguration({ + baseServer: new ServerConfiguration("http://localhost/v2", {}), +}) +const petApi = new PetApi(configuration) + +function createTag() { + const tag = new Tag(); + tag.name = "tag1" + tag.id = Math.floor(Math.random() * 100000) + return tag as Required; +} +const tag = createTag(); + +function createPet() { + const pet = new Pet() + pet.id = Math.floor(Math.random() * 100000) + pet.name = "PetName" + pet.photoUrls = [] + pet.status = 'available' + pet.tags = [ tag ] + return pet as Required; +} +let pet: Required; + +describe("PetApi", () => { + beforeEach(async () => { + pet = createPet(); + await petApi.addPet(pet); + }); + + it("addPet", async () => { + const createdPet = await petApi.getPetById(pet.id) + expect(createdPet).to.deep.equal(pet); + }) + + it("deletePet", async () => { + await petApi.deletePet(pet.id); + let deletedPet; + try { + deletedPet = await petApi.getPetById(pet.id) + } catch (error) { + const err = error as ApiException; + expect(err.code).to.equal(404); + expect(err.message).to.include("Pet not found"); + return; + } + throw new Error("Pet with id " + deletedPet.id + " was not deleted!"); + }) + + it("deleteNonExistantPet", async () => { + // Use an id that is too big for the server to handle. + const nonExistantId = 100000000000000000000000000.0; + try { + await petApi.deletePet(nonExistantId) + } catch (error) { + const err = error as ApiException; + // The 404 response for this endpoint is officially documented, but + // that documentation is not used for generating the client code. + // That means we get an error about the response being undefined + // here. + expect(err.code).to.equal(404); + expect(err.message).to.include("Unknown API Status Code"); + expect(err.body).to.include("404"); + expect(err.body).to.include("message"); + return; + } + throw new Error("Deleted non-existant pet with id " + nonExistantId + "!"); + }) + + it("failRunTimeRequiredParameterCheck", async () => { + try { + await petApi.deletePet(null as unknown as number) + } catch (error) { + const err = error as RequiredError; + expect(err.api).to.equal("PetApi"); + expect(err.message).to.include("PetApi"); + expect(err.method).to.equal("deletePet"); + expect(err.message).to.include("deletePet"); + expect(err.field).to.equal("petId"); + expect(err.message).to.include("petId"); + return; + } + throw new Error("Accepted missing parameter!"); + }) + + it("findPetsByStatus", async () => { + const pets = await petApi.findPetsByStatus(["available"]); + expect(pets.length).to.be.at.least(1); + }) + + it("findPetsByTag", async () => { + const pets = await petApi.findPetsByTags([tag.name]) + expect(pets.length).to.be.at.least(1); + }) + + it("getPetById", async () => { + const returnedPet = await petApi.getPetById(pet.id); + expect(returnedPet).to.deep.equal(pet); + }) + + it("updatePet", async () => { + pet.name = "updated name"; + await petApi.updatePet(pet); + await petApi.updatePet(pet); + + const returnedPet = await petApi.getPetById(pet.id); + expect(returnedPet.id).to.equal(pet.id) + expect(returnedPet.name).to.equal(pet.name); + }) + + it("updatePetWithForm", async () => { + const updatedName = "updated name"; + await petApi.updatePetWithForm(pet.id, updatedName); + + const returnedPet = await petApi.getPetById(pet.id) + expect(returnedPet.id).to.equal(pet.id) + expect(returnedPet.name).to.equal(updatedName); + }) + + it("uploadFile", async () => { + const imageResponse = await fetch(image); + const imageFile = new File([await imageResponse.blob()], "pet.png", { type: "image/png" }); + const response = await petApi.uploadFile(pet.id, "Metadata", imageFile); + expect(response.code).to.be.gte(200).and.lt(300); + expect(response.message).to.contain("pet.png"); + }) +}) diff --git a/samples/openapi3/client/petstore/typescript/tests/browser/test/isomorphic-fetch.test.ts b/samples/openapi3/client/petstore/typescript/tests/browser/test/isomorphic-fetch.test.ts new file mode 100644 index 000000000000..0a4f2cd2107f --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/tests/browser/test/isomorphic-fetch.test.ts @@ -0,0 +1,48 @@ +import { expect } from '@esm-bundle/chai'; +import * as petstore from "ts-petstore-client"; + +let libs: { [key: string]: petstore.HttpLibrary } = { + "isomorphic-fetch": new petstore.IsomorphicFetchHttpLibrary() +} + +for (let libName in libs) { + let lib = libs[libName]; + + describe("Isomorphic Fetch", () => { + it("GET-Request", (done) => { + let requestContext = new petstore.RequestContext("http://httpbin.org/get", petstore.HttpMethod.GET); + requestContext.setHeaderParam("X-Test-Token", "Test-Token"); + lib.send(requestContext).toPromise().then((resp: petstore.ResponseContext) => { + expect(resp.httpStatusCode, "Expected status code to be 200").to.eq(200); + return resp.body.text(); + }).then((bodyText: string) => { + let body = JSON.parse(bodyText); + expect(body["headers"]).to.exist; + expect(body["headers"]["X-Test-Token"]).to.equal("Test-Token"); + done(); + }).catch(done) + }); + + it("POST-Request", (done) => { + let requestContext = new petstore.RequestContext("http://httpbin.org/post", petstore.HttpMethod.POST); + requestContext.setHeaderParam("X-Test-Token", "Test-Token"); + let formData: FormData = new FormData() + formData.append("test", "test2"); + formData.append("testFile", new Blob(["abc"]), "fileName.json"); + + requestContext.setBody(formData); + lib.send(requestContext).toPromise().then( + (resp: petstore.ResponseContext) => { + expect(resp.httpStatusCode, "Expected status code to be 200").to.eq(200); + return resp.body.text(); + }).then((bodyText: string) => { + let body = JSON.parse(bodyText); + expect(body["headers"]).to.exist; + expect(body["headers"]["X-Test-Token"]).to.equal("Test-Token"); + expect(body["files"]["testFile"]).to.equal("abc"); + expect(body["form"]["test"]).to.equal("test2"); + done(); + }).catch(done) + }); + }) +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/typescript/tests/browser/test/pet.ts b/samples/openapi3/client/petstore/typescript/tests/browser/test/pet.ts new file mode 100644 index 000000000000..38ae75322092 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/tests/browser/test/pet.ts @@ -0,0 +1,2 @@ +const pet = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4wMDFScQ1I7VKAAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAD2ElEQVRIx51W2W7jMAzUQR2WHbfo//9ikcSxLev0PkyjTRtv0a4ehCCwZsjhkBLf9519u0opKaUQQgjBe48ftVYhBBF1XWeM6bpOa621llJyzh+P0/fotdZaa845hLCu6+12W9d12zYQKKVSSn3fCyE451JK/PgFwb7vOecYo/d+nudpmkCQcyYirXXOed93IpJSYuecP3L8IoNlWZZlOZ/Py7IgA2vt6+srEVlrlVJa62cE+j58ZADd13Wdpgkq5ZyVUqUUKaXW2jlnrS2llFK+qPTTDKDSsiy32817n3OWUoImhJBSAvpBBvu+fynLYwa11mYhJLGuKxCllFLKbdu2bYsxllLw/VeClBIRCSGeoYEeY8w5e++3bQshxBhRZFQ151xKqbWC4AsOY4xKKZzzfd+llI+yAD2l5L2Hc+Z5XtcVTKUUIjLG5PtCPz13FW3bppRSSjHGoBXUxDGALsvivUeXxRhjjJxzRJ1zbrjP+jDGaJ7nrusQMhLc9x2xQ250wPV6nec5hLBtW0rpMZSUErCaBp8IYOqcszGGiGDNVtLr9Xo+n+d5RvjruqaUEDURPeIKIY4zeH9/H8fROZdzhoVLKc2Ul8sFzXW5XODOnDMs1HSHtrXWf2aw73spJYSglIKyqO3tdpvneZ5nyAIXtTgwGFA/WLbW+ux4ul6vCKrrOqUUJFqWBbMBHLA/HCmEKKUopYgIO8Yq9i+DiDFG0zShlWKMyIAx5r2PMU7TBBrM52ZlBK61tveltVZK8fv6ROC9R49s22athZdQ5Bgjqoq0MJ+hhrW273vnnHMOqYP1oNEw3EspWmv4r5UBEwazBOrlnDnnxhhr7TiOwzC8vLwMwzAMg7X2+TJgjFEIQQiB2YDziLc1ERGhevAlERGRc+50Or29vYFAa42SHBAAt9ZK9DE2EEi7FLGjUXFnWWudc+M4juMIAuec1vq5AIwxanWDShAROnDOYXakBaGMMbiEgT6OIy7kwwIwxj7maJOPc951HQzThge6FJXUWvf35Zzr+x6USO6AANpJKfFR3/cIH2lBety66Cxrbdd1cKcxxjl3eNf/JYAsaBljDO6/Btc4ELsQAs8TRI1Th/31qQb4DscQoFLKWgtQxhj0xQ2Dxw+OtAj+hc4YI+ccnjRoTuy4xPEb0O3Z03Dx56HunwiMMShpm1zNJ/gNUHwj7usn0H9rgCbAfYCQrbV4FiJegMJObf/hotPphI5FvMBljMFUTf12of52Udd1mBDoI7Q72rJJ8X/QHwR932PQwzNIosnyvUN+RDAMAwYypIBzDp+x/7f+ANNHbm3PivMgAAAAAElFTkSuQmCC"; +export default pet; \ No newline at end of file diff --git a/samples/openapi3/client/petstore/typescript/tests/browser/tsconfig.json b/samples/openapi3/client/petstore/typescript/tests/browser/tsconfig.json new file mode 100644 index 000000000000..e591f4eb1bec --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/tests/browser/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "es6", + "useDefineForClassFields": true, + "module": "es6", + "lib": ["es6", "DOM"], + "moduleResolution": "Node", + "strict": true, + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "outDir": "./dist" + }, + "include": ["./test"] +} diff --git a/samples/openapi3/client/petstore/typescript/tests/browser/web-test-runner.config.js b/samples/openapi3/client/petstore/typescript/tests/browser/web-test-runner.config.js new file mode 100644 index 000000000000..db096833265c --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/tests/browser/web-test-runner.config.js @@ -0,0 +1,10 @@ +import { puppeteerLauncher } from '@web/test-runner-puppeteer'; + +export default { + files: "./dist/*.test.js", + nodeResolve: true, + manual: false, + browsers: [ + puppeteerLauncher(), + ], +}; diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/.openapi-generator/FILES b/samples/openapi3/server/petstore/spring-boot-oneof/.openapi-generator/FILES index 422e07678a14..2b0612d53d7f 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/spring-boot-oneof/.openapi-generator/FILES @@ -11,12 +11,17 @@ src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/model/Addressable.java src/main/java/org/openapitools/model/Bar.java src/main/java/org/openapitools/model/BarCreate.java +src/main/java/org/openapitools/model/BarRef.java +src/main/java/org/openapitools/model/BarRefOrValue.java src/main/java/org/openapitools/model/Entity.java src/main/java/org/openapitools/model/EntityRef.java src/main/java/org/openapitools/model/Extensible.java src/main/java/org/openapitools/model/Foo.java src/main/java/org/openapitools/model/FooRef.java src/main/java/org/openapitools/model/FooRefOrValue.java +src/main/java/org/openapitools/model/Pasta.java +src/main/java/org/openapitools/model/Pizza.java +src/main/java/org/openapitools/model/PizzaSpeziale.java src/main/resources/application.properties src/main/resources/openapi.yaml src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/pom.xml b/samples/openapi3/server/petstore/spring-boot-oneof/pom.xml index 8469398e58b4..f7a94804ecbf 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/pom.xml +++ b/samples/openapi3/server/petstore/spring-boot-oneof/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 4.8.1 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 1efd29303f15..2ba1acefbf2a 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 @@ -25,7 +25,7 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen") -public class Bar extends Entity { +public class Bar extends Entity implements BarRefOrValue { @JsonProperty("id") private String id; @@ -115,6 +115,26 @@ public void setFoo(FooRefOrValue foo) { this.foo = foo; } + public Bar href(String href) { + super.setHref(href); + return this; + } + + public Bar atSchemaLocation(String atSchemaLocation) { + super.setAtSchemaLocation(atSchemaLocation); + return this; + } + + public Bar atBaseType(String atBaseType) { + super.setAtBaseType(atBaseType); + return this; + } + + public Bar atType(String atType) { + super.setAtType(atType); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { 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 15a33a51b68a..365251e5d34d 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 @@ -95,6 +95,31 @@ public void setFoo(FooRefOrValue foo) { this.foo = foo; } + public BarCreate href(String href) { + super.setHref(href); + return this; + } + + public BarCreate id(String id) { + super.setId(id); + return this; + } + + public BarCreate atSchemaLocation(String atSchemaLocation) { + super.setAtSchemaLocation(atSchemaLocation); + return this; + } + + public BarCreate atBaseType(String atBaseType) { + super.setAtBaseType(atBaseType); + return this; + } + + public BarCreate atType(String atType) { + super.setAtType(atType); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { 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 new file mode 100644 index 000000000000..abae00509426 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java @@ -0,0 +1,100 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.EntityRef; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * BarRef + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public class BarRef extends EntityRef implements BarRefOrValue { + + public BarRef name(String name) { + super.setName(name); + return this; + } + + public BarRef atReferredType(String atReferredType) { + super.setAtReferredType(atReferredType); + return this; + } + + public BarRef href(String href) { + super.setHref(href); + return this; + } + + public BarRef id(String id) { + super.setId(id); + return this; + } + + public BarRef atSchemaLocation(String atSchemaLocation) { + super.setAtSchemaLocation(atSchemaLocation); + return this; + } + + public BarRef atBaseType(String atBaseType) { + super.setAtBaseType(atBaseType); + return this; + } + + public BarRef atType(String atType) { + super.setAtType(atType); + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BarRef {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRefOrValue.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRefOrValue.java new file mode 100644 index 000000000000..151f8f044417 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRefOrValue.java @@ -0,0 +1,36 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.Bar; +import org.openapitools.model.BarRef; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "@type", // ignore manually set @type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the @type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Bar.class, name = "Bar"), + @JsonSubTypes.Type(value = BarRef.class, name = "BarRef") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public interface BarRefOrValue { + public String getAtType(); +} 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 846a860f6998..b599931e03a1 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 @@ -12,6 +12,9 @@ import org.openapitools.model.BarCreate; import org.openapitools.model.Extensible; import org.openapitools.model.Foo; +import org.openapitools.model.Pasta; +import org.openapitools.model.Pizza; +import org.openapitools.model.PizzaSpeziale; import org.openapitools.jackson.nullable.JsonNullable; import java.time.OffsetDateTime; import javax.validation.Valid; @@ -34,7 +37,10 @@ @JsonSubTypes({ @JsonSubTypes.Type(value = Bar.class, name = "Bar"), @JsonSubTypes.Type(value = BarCreate.class, name = "Bar_Create"), - @JsonSubTypes.Type(value = Foo.class, name = "Foo") + @JsonSubTypes.Type(value = Foo.class, name = "Foo"), + @JsonSubTypes.Type(value = Pasta.class, name = "Pasta"), + @JsonSubTypes.Type(value = Pizza.class, name = "Pizza"), + @JsonSubTypes.Type(value = PizzaSpeziale.class, name = "PizzaSpeziale") }) @Generated(value = "org.openapitools.codegen.languages.SpringCodegen") 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 2c5e68a517f9..4e3ce69f39eb 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 @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import org.openapitools.model.Addressable; +import org.openapitools.model.BarRef; import org.openapitools.model.Extensible; import org.openapitools.model.FooRef; import org.openapitools.jackson.nullable.JsonNullable; @@ -31,6 +32,7 @@ ) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type", visible = true) @JsonSubTypes({ + @JsonSubTypes.Type(value = BarRef.class, name = "BarRef"), @JsonSubTypes.Type(value = FooRef.class, name = "FooRef") }) 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 d73ec9a9d5fa..b0b6f53b1b16 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 @@ -32,21 +32,6 @@ public class Foo extends Entity implements FooRefOrValue { @JsonProperty("fooPropB") private String fooPropB; - @JsonProperty("href") - private String href; - - @JsonProperty("id") - private String id; - - @JsonProperty("@schemaLocation") - private String atSchemaLocation; - - @JsonProperty("@baseType") - private String atBaseType; - - @JsonProperty("@type") - private String atType; - public Foo fooPropA(String fooPropA) { this.fooPropA = fooPropA; return this; @@ -86,100 +71,30 @@ public void setFooPropB(String fooPropB) { } public Foo href(String href) { - this.href = href; + super.setHref(href); return this; } - /** - * Hyperlink reference - * @return href - */ - - @Schema(name = "href", description = "Hyperlink reference", required = false) - public String getHref() { - return href; - } - - public void setHref(String href) { - this.href = href; - } - public Foo id(String id) { - this.id = id; + super.setId(id); return this; } - /** - * unique identifier - * @return id - */ - - @Schema(name = "id", description = "unique identifier", required = false) - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - public Foo atSchemaLocation(String atSchemaLocation) { - this.atSchemaLocation = atSchemaLocation; + super.setAtSchemaLocation(atSchemaLocation); return this; } - /** - * A URI to a JSON-Schema file that defines additional attributes and relationships - * @return atSchemaLocation - */ - - @Schema(name = "@schemaLocation", description = "A URI to a JSON-Schema file that defines additional attributes and relationships", required = false) - public String getAtSchemaLocation() { - return atSchemaLocation; - } - - public void setAtSchemaLocation(String atSchemaLocation) { - this.atSchemaLocation = atSchemaLocation; - } - public Foo atBaseType(String atBaseType) { - this.atBaseType = atBaseType; + super.setAtBaseType(atBaseType); return this; } - /** - * When sub-classing, this defines the super-class - * @return atBaseType - */ - - @Schema(name = "@baseType", description = "When sub-classing, this defines the super-class", required = false) - public String getAtBaseType() { - return atBaseType; - } - - public void setAtBaseType(String atBaseType) { - this.atBaseType = atBaseType; - } - public Foo atType(String atType) { - this.atType = atType; + super.setAtType(atType); return this; } - /** - * When sub-classing, this defines the sub-class Extensible name - * @return atType - */ - @NotNull - @Schema(name = "@type", description = "When sub-classing, this defines the sub-class Extensible name", required = true) - public String getAtType() { - return atType; - } - - public void setAtType(String atType) { - this.atType = atType; - } - @Override public boolean equals(Object o) { if (this == o) { @@ -191,17 +106,12 @@ public boolean equals(Object o) { Foo foo = (Foo) o; return Objects.equals(this.fooPropA, foo.fooPropA) && Objects.equals(this.fooPropB, foo.fooPropB) && - Objects.equals(this.href, foo.href) && - Objects.equals(this.id, foo.id) && - Objects.equals(this.atSchemaLocation, foo.atSchemaLocation) && - Objects.equals(this.atBaseType, foo.atBaseType) && - Objects.equals(this.atType, foo.atType) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(fooPropA, fooPropB, href, id, atSchemaLocation, atBaseType, atType, super.hashCode()); + return Objects.hash(fooPropA, fooPropB, super.hashCode()); } @Override @@ -211,11 +121,6 @@ public String toString() { sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" fooPropA: ").append(toIndentedString(fooPropA)).append("\n"); sb.append(" fooPropB: ").append(toIndentedString(fooPropB)).append("\n"); - sb.append(" href: ").append(toIndentedString(href)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" atSchemaLocation: ").append(toIndentedString(atSchemaLocation)).append("\n"); - sb.append(" atBaseType: ").append(toIndentedString(atBaseType)).append("\n"); - sb.append(" atType: ").append(toIndentedString(atType)).append("\n"); sb.append("}"); return sb.toString(); } 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 72c26b5de06f..5900228902d6 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 @@ -29,21 +29,6 @@ public class FooRef extends EntityRef implements FooRefOrValue { @JsonProperty("foorefPropA") private String foorefPropA; - @JsonProperty("href") - private String href; - - @JsonProperty("id") - private String id; - - @JsonProperty("@schemaLocation") - private String atSchemaLocation; - - @JsonProperty("@baseType") - private String atBaseType; - - @JsonProperty("@type") - private String atType; - public FooRef foorefPropA(String foorefPropA) { this.foorefPropA = foorefPropA; return this; @@ -63,101 +48,41 @@ public void setFoorefPropA(String foorefPropA) { this.foorefPropA = foorefPropA; } - public FooRef href(String href) { - this.href = href; + public FooRef name(String name) { + super.setName(name); return this; } - /** - * Hyperlink reference - * @return href - */ - - @Schema(name = "href", description = "Hyperlink reference", required = false) - public String getHref() { - return href; + public FooRef atReferredType(String atReferredType) { + super.setAtReferredType(atReferredType); + return this; } - public void setHref(String href) { - this.href = href; + public FooRef href(String href) { + super.setHref(href); + return this; } public FooRef id(String id) { - this.id = id; + super.setId(id); return this; } - /** - * unique identifier - * @return id - */ - - @Schema(name = "id", description = "unique identifier", required = false) - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - public FooRef atSchemaLocation(String atSchemaLocation) { - this.atSchemaLocation = atSchemaLocation; + super.setAtSchemaLocation(atSchemaLocation); return this; } - /** - * A URI to a JSON-Schema file that defines additional attributes and relationships - * @return atSchemaLocation - */ - - @Schema(name = "@schemaLocation", description = "A URI to a JSON-Schema file that defines additional attributes and relationships", required = false) - public String getAtSchemaLocation() { - return atSchemaLocation; - } - - public void setAtSchemaLocation(String atSchemaLocation) { - this.atSchemaLocation = atSchemaLocation; - } - public FooRef atBaseType(String atBaseType) { - this.atBaseType = atBaseType; + super.setAtBaseType(atBaseType); return this; } - /** - * When sub-classing, this defines the super-class - * @return atBaseType - */ - - @Schema(name = "@baseType", description = "When sub-classing, this defines the super-class", required = false) - public String getAtBaseType() { - return atBaseType; - } - - public void setAtBaseType(String atBaseType) { - this.atBaseType = atBaseType; - } - public FooRef atType(String atType) { - this.atType = atType; + super.setAtType(atType); return this; } - /** - * When sub-classing, this defines the sub-class Extensible name - * @return atType - */ - @NotNull - @Schema(name = "@type", description = "When sub-classing, this defines the sub-class Extensible name", required = true) - public String getAtType() { - return atType; - } - - public void setAtType(String atType) { - this.atType = atType; - } - @Override public boolean equals(Object o) { if (this == o) { @@ -168,17 +93,12 @@ public boolean equals(Object o) { } FooRef fooRef = (FooRef) o; return Objects.equals(this.foorefPropA, fooRef.foorefPropA) && - Objects.equals(this.href, fooRef.href) && - Objects.equals(this.id, fooRef.id) && - Objects.equals(this.atSchemaLocation, fooRef.atSchemaLocation) && - Objects.equals(this.atBaseType, fooRef.atBaseType) && - Objects.equals(this.atType, fooRef.atType) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(foorefPropA, href, id, atSchemaLocation, atBaseType, atType, super.hashCode()); + return Objects.hash(foorefPropA, super.hashCode()); } @Override @@ -187,11 +107,6 @@ public String toString() { sb.append("class FooRef {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" foorefPropA: ").append(toIndentedString(foorefPropA)).append("\n"); - sb.append(" href: ").append(toIndentedString(href)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" atSchemaLocation: ").append(toIndentedString(atSchemaLocation)).append("\n"); - sb.append(" atBaseType: ").append(toIndentedString(atBaseType)).append("\n"); - sb.append(" atType: ").append(toIndentedString(atType)).append("\n"); sb.append("}"); return sb.toString(); } 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 new file mode 100644 index 000000000000..116c2687b84f --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pasta.java @@ -0,0 +1,115 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.Entity; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * Pasta + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public class Pasta extends Entity { + + @JsonProperty("vendor") + private String vendor; + + public Pasta vendor(String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * @return vendor + */ + + @Schema(name = "vendor", required = false) + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public Pasta href(String href) { + super.setHref(href); + return this; + } + + public Pasta id(String id) { + super.setId(id); + return this; + } + + public Pasta atSchemaLocation(String atSchemaLocation) { + super.setAtSchemaLocation(atSchemaLocation); + return this; + } + + public Pasta atBaseType(String atBaseType) { + super.setAtBaseType(atBaseType); + return this; + } + + public Pasta atType(String atType) { + super.setAtType(atType); + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pasta pasta = (Pasta) o; + return Objects.equals(this.vendor, pasta.vendor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(vendor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pasta {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).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/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 new file mode 100644 index 000000000000..015b75a8053b --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pizza.java @@ -0,0 +1,125 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.math.BigDecimal; +import org.openapitools.model.Entity; +import org.openapitools.model.PizzaSpeziale; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * Pizza + */ + +@JsonIgnoreProperties( + value = "@type", // ignore manually set @type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the @type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = PizzaSpeziale.class, name = "PizzaSpeziale") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public class Pizza extends Entity { + + @JsonProperty("pizzaSize") + private BigDecimal pizzaSize; + + public Pizza pizzaSize(BigDecimal pizzaSize) { + this.pizzaSize = pizzaSize; + return this; + } + + /** + * Get pizzaSize + * @return pizzaSize + */ + @Valid + @Schema(name = "pizzaSize", required = false) + public BigDecimal getPizzaSize() { + return pizzaSize; + } + + public void setPizzaSize(BigDecimal pizzaSize) { + this.pizzaSize = pizzaSize; + } + + public Pizza href(String href) { + super.setHref(href); + return this; + } + + public Pizza id(String id) { + super.setId(id); + return this; + } + + public Pizza atSchemaLocation(String atSchemaLocation) { + super.setAtSchemaLocation(atSchemaLocation); + return this; + } + + public Pizza atBaseType(String atBaseType) { + super.setAtBaseType(atBaseType); + return this; + } + + public Pizza atType(String atType) { + super.setAtType(atType); + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pizza pizza = (Pizza) o; + return Objects.equals(this.pizzaSize, pizza.pizzaSize) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(pizzaSize, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pizza {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" pizzaSize: ").append(toIndentedString(pizzaSize)).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/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 new file mode 100644 index 000000000000..6b50ea036458 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java @@ -0,0 +1,121 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.Pizza; +import java.math.BigDecimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * PizzaSpeziale + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public class PizzaSpeziale extends Pizza { + + @JsonProperty("toppings") + private String toppings; + + public PizzaSpeziale toppings(String toppings) { + this.toppings = toppings; + return this; + } + + /** + * Get toppings + * @return toppings + */ + + @Schema(name = "toppings", required = false) + public String getToppings() { + return toppings; + } + + public void setToppings(String toppings) { + this.toppings = toppings; + } + + public PizzaSpeziale pizzaSize(BigDecimal pizzaSize) { + super.setPizzaSize(pizzaSize); + return this; + } + + public PizzaSpeziale href(String href) { + super.setHref(href); + return this; + } + + public PizzaSpeziale id(String id) { + super.setId(id); + return this; + } + + public PizzaSpeziale atSchemaLocation(String atSchemaLocation) { + super.setAtSchemaLocation(atSchemaLocation); + return this; + } + + public PizzaSpeziale atBaseType(String atBaseType) { + super.setAtBaseType(atBaseType); + return this; + } + + public PizzaSpeziale atType(String atType) { + super.setAtType(atType); + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PizzaSpeziale pizzaSpeziale = (PizzaSpeziale) o; + return Objects.equals(this.toppings, pizzaSpeziale.toppings) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(toppings, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PizzaSpeziale {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" toppings: ").append(toIndentedString(toppings)).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/openapi3/server/petstore/spring-boot-oneof/src/main/resources/openapi.yaml b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/resources/openapi.yaml index 462a9cb829c7..9ab9dccf5dfc 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/resources/openapi.yaml +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/resources/openapi.yaml @@ -166,12 +166,14 @@ components: FooRef: allOf: - $ref: '#/components/schemas/EntityRef' - discriminator: - propertyName: '@type' properties: foorefPropA: type: string type: object + BarRef: + allOf: + - $ref: '#/components/schemas/EntityRef' + type: object Bar_Create: allOf: - $ref: '#/components/schemas/Entity' @@ -203,3 +205,30 @@ components: required: - id type: object + BarRefOrValue: + oneOf: + - $ref: '#/components/schemas/Bar' + - $ref: '#/components/schemas/BarRef' + type: object + x-one-of-name: BarRefOrValue + Pizza: + allOf: + - $ref: '#/components/schemas/Entity' + properties: + pizzaSize: + type: number + type: object + Pasta: + allOf: + - $ref: '#/components/schemas/Entity' + properties: + vendor: + type: string + type: object + PizzaSpeziale: + allOf: + - $ref: '#/components/schemas/Pizza' + properties: + toppings: + type: string + type: object diff --git a/samples/openapi3/server/petstore/spring-boot-springdoc/pom.xml b/samples/openapi3/server/petstore/spring-boot-springdoc/pom.xml index e592150bddb9..63ca2d73aafe 100644 --- a/samples/openapi3/server/petstore/spring-boot-springdoc/pom.xml +++ b/samples/openapi3/server/petstore/spring-boot-springdoc/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 diff --git a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/pom.xml b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/pom.xml index 9369336b3d72..97823b08ae45 100644 --- a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/pom.xml +++ b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 4.8.1 diff --git a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java index 3302e7f30ca0..a5ffffc075a7 100644 --- a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java @@ -88,6 +88,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java index 3cb2a5dd4a32..f8b09521a77f 100644 --- a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java +++ b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java @@ -57,6 +57,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java index f03703acc48a..472111e924cf 100644 --- a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java +++ b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java @@ -48,6 +48,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-delegate/pom.xml b/samples/openapi3/server/petstore/springboot-delegate/pom.xml index f11caa4ec23f..3a7f8e036c9a 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/pom.xml +++ b/samples/openapi3/server/petstore/springboot-delegate/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 4.8.1 diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java index 375c8ce6e448..7208cedbd0b5 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java index 7e195225a7e0..0e7e1b097362 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java index 2201d26277a1..155bff326518 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/pom.xml b/samples/openapi3/server/petstore/springboot-implicitHeaders/pom.xml index ebb026ea6318..6a156cab2dbd 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/pom.xml +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 4.8.1 diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java index 375c8ce6e448..7208cedbd0b5 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java index 7e195225a7e0..0e7e1b097362 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java index 2201d26277a1..155bff326518 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-reactive/pom.xml b/samples/openapi3/server/petstore/springboot-reactive/pom.xml index d0b35422df79..dd43545e43e8 100644 --- a/samples/openapi3/server/petstore/springboot-reactive/pom.xml +++ b/samples/openapi3/server/petstore/springboot-reactive/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 4.8.1 diff --git a/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java b/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java index 375c8ce6e448..7208cedbd0b5 100644 --- a/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java index 7e195225a7e0..0e7e1b097362 100644 --- a/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java +++ b/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java index 2201d26277a1..155bff326518 100644 --- a/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java +++ b/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-source/pom.xml b/samples/openapi3/server/petstore/springboot-source/pom.xml index fc100273aa6e..6a8d71279803 100644 --- a/samples/openapi3/server/petstore/springboot-source/pom.xml +++ b/samples/openapi3/server/petstore/springboot-source/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 4.8.1 diff --git a/samples/openapi3/server/petstore/springboot-useoptional/pom.xml b/samples/openapi3/server/petstore/springboot-useoptional/pom.xml index e185d4ba8e5b..4bbe4fe62b44 100644 --- a/samples/openapi3/server/petstore/springboot-useoptional/pom.xml +++ b/samples/openapi3/server/petstore/springboot-useoptional/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 4.8.1 diff --git a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java index 375c8ce6e448..7208cedbd0b5 100644 --- a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java index 7e195225a7e0..0e7e1b097362 100644 --- a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java +++ b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java index 2201d26277a1..155bff326518 100644 --- a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java +++ b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot/pom.xml b/samples/openapi3/server/petstore/springboot/pom.xml index f39e01c3d97c..eb58747fb543 100644 --- a/samples/openapi3/server/petstore/springboot/pom.xml +++ b/samples/openapi3/server/petstore/springboot/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 4.8.1 diff --git a/samples/server/petstore/java-camel/pom.xml b/samples/server/petstore/java-camel/pom.xml index 8723287db730..d19df46cee28 100644 --- a/samples/server/petstore/java-camel/pom.xml +++ b/samples/server/petstore/java-camel/pom.xml @@ -38,6 +38,7 @@ Do not edit the class manually. + UTF-8 2.6.2 3.14.0 @@ -182,4 +183,4 @@ Do not edit the class manually. - \ No newline at end of file + diff --git a/samples/server/petstore/java-micronaut-server/pom.xml b/samples/server/petstore/java-micronaut-server/pom.xml index 36e2c01d0352..7ffa53d172b7 100644 --- a/samples/server/petstore/java-micronaut-server/pom.xml +++ b/samples/server/petstore/java-micronaut-server/pom.xml @@ -16,6 +16,7 @@ jar 1.8 + UTF-8 3.3.1 diff --git a/samples/server/petstore/jaxrs-cxf-cdi-default-value/pom.xml b/samples/server/petstore/jaxrs-cxf-cdi-default-value/pom.xml new file mode 100644 index 000000000000..8570bd5504c3 --- /dev/null +++ b/samples/server/petstore/jaxrs-cxf-cdi-default-value/pom.xml @@ -0,0 +1,103 @@ + + 4.0.0 + org.openapitools + jaxrs-cxf-cdi-default-value + war + jaxrs-cxf-cdi-default-value + 1.0.0 + + + + + src/main/java + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + maven-war-plugin + 3.1.0 + + false + + + + + + + + + + javax + javaee-api + 7.0 + provided + + + + + org.apache.cxf + cxf-rt-frontend-jaxrs + + + 3.1.2 + provided + + + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + [2.8.3,2.12.1] + + + + + io.swagger + swagger-annotations + [1.5.3,1.5.16] + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + + + + + UTF-8 + 2.0.2 + + + diff --git a/samples/server/petstore/jaxrs-cxf-cdi/pom.xml b/samples/server/petstore/jaxrs-cxf-cdi/pom.xml index b39c809b0c24..e7e5910ef3c1 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/pom.xml +++ b/samples/server/petstore/jaxrs-cxf-cdi/pom.xml @@ -115,6 +115,7 @@ + UTF-8 2.0.2 diff --git a/samples/server/petstore/jaxrs-resteasy/default-value/pom.xml b/samples/server/petstore/jaxrs-resteasy/default-value/pom.xml new file mode 100644 index 000000000000..f73452466702 --- /dev/null +++ b/samples/server/petstore/jaxrs-resteasy/default-value/pom.xml @@ -0,0 +1,201 @@ + + 4.0.0 + org.openapitools + jaxrs-resteasy-default-value + war + jaxrs-resteasy-default-value + 1.0.0 + + + src/main/java + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + + src/gen/java + + + + + + + + + + + javax + javaee-api + 7.0 + provided + + + + io.swagger + swagger-annotations + ${swagger-core-version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + org.slf4j + slf4j-log4j12 + ${slf4j-version} + + + jakarta.servlet + jakarta.servlet-api + ${servlet-api-version} + provided + + + + org.jboss.resteasy + resteasy-jaxrs + ${resteasy-version} + provided + + + org.jboss.resteasy + jaxrs-api + 3.0.12.Final + provided + + + org.jboss.resteasy + resteasy-validator-provider-11 + 3.6.3.SP1 + provided + + + org.jboss.resteasy + resteasy-multipart-provider + ${resteasy-version} + provided + + + org.jboss.resteasy + resteasy-jackson2-provider + ${resteasy-version} + provided + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + + + joda-time + joda-time + 2.7 + + + io.swagger + swagger-jaxrs + ${swagger-core-version} + + + junit + junit + ${junit-version} + test + + + org.testng + testng + 6.8.8 + test + + + junit + junit + + + snakeyaml + org.yaml + + + bsh + org.beanshell + + + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + UTF-8 + 1.5.22 + 2.11.2 + 9.2.9.v20150224 + 3.13.0.Final + 1.6.3 + 4.13.1 + 4.0.4 + 1.3.5 + 2.0.2 + + diff --git a/samples/server/petstore/jaxrs-resteasy/default/pom.xml b/samples/server/petstore/jaxrs-resteasy/default/pom.xml index e1d601da6e41..77392afb84d1 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/pom.xml +++ b/samples/server/petstore/jaxrs-resteasy/default/pom.xml @@ -185,6 +185,7 @@ + UTF-8 1.5.22 2.11.2 9.2.9.v20150224 diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/pom.xml b/samples/server/petstore/jaxrs-resteasy/eap-java8/pom.xml index 43183c9f0bfe..c01897f1b69a 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/pom.xml +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/pom.xml @@ -168,6 +168,7 @@ + UTF-8 1.5.18 9.2.9.v20150224 3.0.11.Final diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/pom.xml b/samples/server/petstore/jaxrs-resteasy/eap-joda/pom.xml index e9dee66072a4..ff8599c0aab9 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/pom.xml +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/pom.xml @@ -168,6 +168,7 @@ + UTF-8 1.5.18 9.2.9.v20150224 3.0.11.Final diff --git a/samples/server/petstore/jaxrs-resteasy/eap/pom.xml b/samples/server/petstore/jaxrs-resteasy/eap/pom.xml index ad6ea8709e51..ab704408339c 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/pom.xml +++ b/samples/server/petstore/jaxrs-resteasy/eap/pom.xml @@ -168,6 +168,7 @@ + UTF-8 1.5.18 9.2.9.v20150224 3.0.11.Final diff --git a/samples/server/petstore/jaxrs-resteasy/java8/pom.xml b/samples/server/petstore/jaxrs-resteasy/java8/pom.xml index 25abd47ebca7..8a1b40c198f3 100644 --- a/samples/server/petstore/jaxrs-resteasy/java8/pom.xml +++ b/samples/server/petstore/jaxrs-resteasy/java8/pom.xml @@ -185,6 +185,7 @@ + UTF-8 1.5.22 2.11.2 9.2.9.v20150224 diff --git a/samples/server/petstore/jaxrs-resteasy/joda/pom.xml b/samples/server/petstore/jaxrs-resteasy/joda/pom.xml index 98ba123559da..b0713f7f7329 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/pom.xml +++ b/samples/server/petstore/jaxrs-resteasy/joda/pom.xml @@ -185,6 +185,7 @@ + UTF-8 1.5.22 2.11.2 9.2.9.v20150224 diff --git a/samples/server/petstore/jaxrs-spec-interface/pom.xml b/samples/server/petstore/jaxrs-spec-interface/pom.xml index 9ec53541612c..4e4151642745 100644 --- a/samples/server/petstore/jaxrs-spec-interface/pom.xml +++ b/samples/server/petstore/jaxrs-spec-interface/pom.xml @@ -93,6 +93,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.9 4.13.2 2.10.13 diff --git a/samples/server/petstore/jaxrs-spec/pom.xml b/samples/server/petstore/jaxrs-spec/pom.xml index 8326dd08272c..6bcd26f49adf 100644 --- a/samples/server/petstore/jaxrs-spec/pom.xml +++ b/samples/server/petstore/jaxrs-spec/pom.xml @@ -128,6 +128,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.9 4.13.2 2.10.13 diff --git a/samples/server/petstore/kotlin-springboot-delegate/pom.xml b/samples/server/petstore/kotlin-springboot-delegate/pom.xml index f7094ec0e103..4d5fc7828f68 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/pom.xml +++ b/samples/server/petstore/kotlin-springboot-delegate/pom.xml @@ -6,6 +6,7 @@ openapi-spring 1.0.0 + UTF-8 1.3.30 1.2.0 1.3.5 diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/pom.xml b/samples/server/petstore/kotlin-springboot-modelMutable/pom.xml index f7094ec0e103..4d5fc7828f68 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/pom.xml +++ b/samples/server/petstore/kotlin-springboot-modelMutable/pom.xml @@ -6,6 +6,7 @@ openapi-spring 1.0.0 + UTF-8 1.3.30 1.2.0 1.3.5 diff --git a/samples/server/petstore/kotlin-springboot-reactive/pom.xml b/samples/server/petstore/kotlin-springboot-reactive/pom.xml index cb52346a5c9e..22b7fba7d4cf 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/pom.xml +++ b/samples/server/petstore/kotlin-springboot-reactive/pom.xml @@ -6,6 +6,7 @@ openapi-spring 1.0.0 + UTF-8 1.3.30 1.2.0 1.3.5 diff --git a/samples/server/petstore/kotlin-springboot/pom.xml b/samples/server/petstore/kotlin-springboot/pom.xml index f7094ec0e103..4d5fc7828f68 100644 --- a/samples/server/petstore/kotlin-springboot/pom.xml +++ b/samples/server/petstore/kotlin-springboot/pom.xml @@ -6,6 +6,7 @@ openapi-spring 1.0.0 + UTF-8 1.3.30 1.2.0 1.3.5 diff --git a/samples/server/petstore/php-slim4/README.md b/samples/server/petstore/php-slim4/README.md index a99f4a13cc49..dc91b2bcbebd 100644 --- a/samples/server/petstore/php-slim4/README.md +++ b/samples/server/petstore/php-slim4/README.md @@ -98,6 +98,22 @@ Switch your app environment to development in `public/.htaccess` file: ``` +## Mock Server +Since this feature should be used for development only, change environment to `development` and send additional HTTP header `X-OpenAPIServer-Mock: ping` with any request to get mocked response. +CURL example: +```console +curl --request GET \ + --url 'http://localhost:8888/v2/pet/findByStatus?status=available' \ + --header 'accept: application/json' \ + --header 'X-OpenAPIServer-Mock: ping' +[{"id":-8738629417578509312,"category":{"id":-4162503862215270400,"name":"Lorem ipsum dol"},"name":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem i","photoUrls":["Lor"],"tags":[{"id":-3506202845849391104,"name":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectet"}],"status":"pending"}] +``` + +Used packages: +* [Openapi Data Mocker](https://github.com/ybelenko/openapi-data-mocker) - first implementation of OAS3 fake data generator. +* [Openapi Data Mocker Server Middleware](https://github.com/ybelenko/openapi-data-mocker-server-middleware) - PSR-15 HTTP server middleware. +* [Openapi Data Mocker Interfaces](https://github.com/ybelenko/openapi-data-mocker-interfaces) - package with mocking interfaces. + ## API Endpoints All URIs are relative to *http://petstore.swagger.io/v2* diff --git a/samples/server/petstore/php-slim4/composer.json b/samples/server/petstore/php-slim4/composer.json index 0e99d73f62c5..afb802fcc6bf 100644 --- a/samples/server/petstore/php-slim4/composer.json +++ b/samples/server/petstore/php-slim4/composer.json @@ -14,7 +14,7 @@ "php-di/slim-bridge": "^3.2", "slim/psr7": "^1.1.0", "ybelenko/openapi-data-mocker": "^1.0", - "ybelenko/openapi-data-mocker-server-middleware": "^1.0" + "ybelenko/openapi-data-mocker-server-middleware": "^1.2" }, "require-dev": { "overtrue/phplint": "^2.0.2", diff --git a/samples/server/petstore/php-slim4/config/dev/default.inc.php b/samples/server/petstore/php-slim4/config/dev/default.inc.php index 4bc496fc288d..b30088b9fca2 100644 --- a/samples/server/petstore/php-slim4/config/dev/default.inc.php +++ b/samples/server/petstore/php-slim4/config/dev/default.inc.php @@ -62,4 +62,37 @@ 'pdo.options' => [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, ], + + // mocker + // OBVIOUSLY MUST NOT BE USED for production + // @see https://github.com/ybelenko/openapi-data-mocker-server-middleware + 'mocker.getMockStatusCodeCallback' => function () { + return function (\Psr\Http\Message\ServerRequestInterface $request, array $responses) { + // check if client clearly asks for mocked response + $pingHeader = 'X-OpenAPIServer-Mock'; + $pingHeaderCode = 'X-OpenAPIServer-Mock-Code'; + if ( + $request->hasHeader($pingHeader) + && $request->getHeader($pingHeader)[0] === 'ping' + ) { + $responses = (array) $responses; + $requestedResponseCode = ($request->hasHeader($pingHeaderCode)) ? $request->getHeader($pingHeaderCode)[0] : 'default'; + if (array_key_exists($requestedResponseCode, $responses)) { + return $requestedResponseCode; + } + + // return first response key + reset($responses); + return key($responses); + } + + return false; + }; + }, + 'mocker.afterCallback' => function () { + return function (\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response) { + // mark mocked response to distinguish real and fake responses + return $response->withHeader('X-OpenAPIServer-Mock', 'pong'); + }; + }, ]; diff --git a/samples/server/petstore/php-slim4/lib/App/RegisterDependencies.php b/samples/server/petstore/php-slim4/lib/App/RegisterDependencies.php index 0cd54563ed99..137d2671a385 100644 --- a/samples/server/petstore/php-slim4/lib/App/RegisterDependencies.php +++ b/samples/server/petstore/php-slim4/lib/App/RegisterDependencies.php @@ -72,6 +72,15 @@ public function __invoke(\DI\ContainerBuilder $containerBuilder): void \DI\get('pdo.password'), \DI\get('pdo.options', null) ), + + // DataMocker + // @see https://github.com/ybelenko/openapi-data-mocker-server-middleware + \OpenAPIServer\Mock\OpenApiDataMockerInterface::class => \DI\create(\OpenAPIServer\Mock\OpenApiDataMocker::class) + ->method('setModelsNamespace', 'OpenAPIServer\Model\\'), + + \OpenAPIServer\Mock\OpenApiDataMockerRouteMiddlewareFactory::class => \DI\autowire() + ->constructorParameter('getMockStatusCodeCallback', \DI\get('mocker.getMockStatusCodeCallback')) + ->constructorParameter('afterCallback', \DI\get('mocker.afterCallback')), ]); } } diff --git a/samples/server/petstore/php-slim4/lib/App/RegisterRoutes.php b/samples/server/petstore/php-slim4/lib/App/RegisterRoutes.php index 4cb4f853ae11..0c719abdfb97 100644 --- a/samples/server/petstore/php-slim4/lib/App/RegisterRoutes.php +++ b/samples/server/petstore/php-slim4/lib/App/RegisterRoutes.php @@ -845,6 +845,16 @@ public function __invoke(\Slim\App $app): void return $response; }); + // create mock middleware factory + /** @var \Psr\Container\ContainerInterface */ + $container = $app->getContainer(); + /** @var \OpenAPIServer\Mock\OpenApiDataMockerRouteMiddlewareFactory|null */ + $mockMiddlewareFactory = null; + if ($container->has(\OpenAPIServer\Mock\OpenApiDataMockerRouteMiddlewareFactory::class)) { + // I know, anti-pattern. Don't retrieve dependency directly from container + $mockMiddlewareFactory = $container->get(\OpenAPIServer\Mock\OpenApiDataMockerRouteMiddlewareFactory::class); + } + foreach ($this->operations as $operation) { $callback = function (ServerRequestInterface $request) use ($operation) { $message = "How about extending {$operation['classname']} by {$operation['apiPackage']}\\{$operation['userClassname']} class implementing {$operation['operationId']} as a {$operation['httpMethod']} method?"; @@ -858,6 +868,13 @@ public function __invoke(\Slim\App $app): void $callback = ["\\{$operation['apiPackage']}\\{$operation['userClassname']}", $operation['operationId']]; } + if ($mockMiddlewareFactory) { + $mockSchemaResponses = array_map(function ($item) { + return json_decode($item['jsonSchema'], true); + }, $operation['responses']); + $middlewares[] = $mockMiddlewareFactory->create($mockSchemaResponses); + } + $route = $app->map( [$operation['httpMethod']], "{$operation['basePathWithoutHost']}{$operation['path']}", diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/pom.xml b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/pom.xml index ac91daca7cd7..2959346ed4e5 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/pom.xml +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 4.8.1 diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/BigCat.java index 375c8ce6e448..7208cedbd0b5 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/BigCat.java @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Cat.java index 7e195225a7e0..0e7e1b097362 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Cat.java @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Dog.java index 2201d26277a1..155bff326518 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Dog.java @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/spring-boot-nullable-set/pom.xml b/samples/server/petstore/spring-boot-nullable-set/pom.xml index 46a188a0172a..e38cc50fe204 100644 --- a/samples/server/petstore/spring-boot-nullable-set/pom.xml +++ b/samples/server/petstore/spring-boot-nullable-set/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 1.6.6 4.8.1 diff --git a/samples/server/petstore/spring-mvc-default-value/pom.xml b/samples/server/petstore/spring-mvc-default-value/pom.xml new file mode 100644 index 000000000000..b7816ca34c22 --- /dev/null +++ b/samples/server/petstore/spring-mvc-default-value/pom.xml @@ -0,0 +1,73 @@ + + 4.0.0 + org.openapitools + spring-mvc-default-value + jar + spring-mvc-default-value + 1.0.0 + + 1.8 + ${java.version} + ${java.version} + UTF-8 + 2.9.2 + + + org.springframework.boot + spring-boot-starter-parent + 2.5.8 + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.data + spring-data-commons + + + + io.springfox + springfox-swagger2 + ${springfox.version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + org.openapitools + jackson-databind-nullable + 0.2.2 + + + + org.springframework.boot + spring-boot-starter-validation + + + com.fasterxml.jackson.core + jackson-databind + + + diff --git a/samples/server/petstore/spring-mvc-j8-async/pom.xml b/samples/server/petstore/spring-mvc-j8-async/pom.xml new file mode 100644 index 000000000000..4b7ca20cde74 --- /dev/null +++ b/samples/server/petstore/spring-mvc-j8-async/pom.xml @@ -0,0 +1,184 @@ + + 4.0.0 + org.openapitools + spring-mvc-server-j8-async + jar + spring-mvc-server-j8-async + 1.0.0 + + src/main/java + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty-version} + + + /v2 + + target/${project.artifactId}-${project.version} + 8079 + stopit + 10 + + 8002 + 60000 + + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + + + + + start-jetty + pre-integration-test + + start + + + 0 + true + + + + stop-jetty + post-integration-test + + stop + + + + + + + + + org.slf4j + slf4j-log4j12 + ${slf4j-version} + + + + + org.springframework + spring-core + ${spring-version} + + + org.springframework + spring-webmvc + ${spring-version} + + + org.springframework + spring-web + ${spring-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + + + jakarta.xml.bind + jakarta.xml.bind-api + ${jakarta.xml.bind-version} + + + + io.springfox + springfox-swagger2 + ${springfox-version} + + + com.fasterxml.jackson.core + jackson-annotations + + + + + io.springfox + springfox-swagger-ui + ${springfox-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + junit + junit + ${junit-version} + test + + + jakarta.servlet + jakarta.servlet-api + ${servlet-api-version} + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + + org.springframework.data + spring-data-commons + 2.0.11.RELEASE + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + + + + 1.8 + UTF-8 + ${java.version} + ${java.version} + 1.3.5 + 2.3.3 + 9.2.15.v20160210 + 1.7.21 + 4.13.1 + 4.0.4 + 2.9.2 + 2.9.9 + 2.8.4 + 2.0.2 + 4.3.20.RELEASE + 0.2.2 + 2.9.8 + 1.6.3 + + diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml b/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml new file mode 100644 index 000000000000..7f19cad943a2 --- /dev/null +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml @@ -0,0 +1,184 @@ + + 4.0.0 + org.openapitools + spring-mvc-j8-localdatetime + jar + spring-mvc-j8-localdatetime + 1.0.0 + + src/main/java + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty-version} + + + /v2 + + target/${project.artifactId}-${project.version} + 8079 + stopit + 10 + + 8002 + 60000 + + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + + + + + start-jetty + pre-integration-test + + start + + + 0 + true + + + + stop-jetty + post-integration-test + + stop + + + + + + + + + org.slf4j + slf4j-log4j12 + ${slf4j-version} + + + + + org.springframework + spring-core + ${spring-version} + + + org.springframework + spring-webmvc + ${spring-version} + + + org.springframework + spring-web + ${spring-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + + + jakarta.xml.bind + jakarta.xml.bind-api + ${jakarta.xml.bind-version} + + + + io.springfox + springfox-swagger2 + ${springfox-version} + + + com.fasterxml.jackson.core + jackson-annotations + + + + + io.springfox + springfox-swagger-ui + ${springfox-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + junit + junit + ${junit-version} + test + + + jakarta.servlet + jakarta.servlet-api + ${servlet-api-version} + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + + org.springframework.data + spring-data-commons + 2.0.11.RELEASE + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + + + + 1.8 + UTF-8 + ${java.version} + ${java.version} + 1.3.5 + 2.3.3 + 9.2.15.v20160210 + 1.7.21 + 4.13.1 + 4.0.4 + 2.9.2 + 2.9.9 + 2.8.4 + 2.0.2 + 4.3.20.RELEASE + 0.2.2 + 2.9.8 + 1.6.3 + + diff --git a/samples/server/petstore/spring-mvc-no-nullable/pom.xml b/samples/server/petstore/spring-mvc-no-nullable/pom.xml new file mode 100644 index 000000000000..354743fe814b --- /dev/null +++ b/samples/server/petstore/spring-mvc-no-nullable/pom.xml @@ -0,0 +1,178 @@ + + 4.0.0 + org.openapitools + spring-mvc-server-no-nullable + jar + spring-mvc-server-no-nullable + 1.0.0 + + src/main/java + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty-version} + + + /v2 + + target/${project.artifactId}-${project.version} + 8079 + stopit + 10 + + 8002 + 60000 + + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + + + + + start-jetty + pre-integration-test + + start + + + 0 + true + + + + stop-jetty + post-integration-test + + stop + + + + + + + + + org.slf4j + slf4j-log4j12 + ${slf4j-version} + + + + + org.springframework + spring-core + ${spring-version} + + + org.springframework + spring-webmvc + ${spring-version} + + + org.springframework + spring-web + ${spring-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + + + jakarta.xml.bind + jakarta.xml.bind-api + ${jakarta.xml.bind-version} + + + + io.springfox + springfox-swagger2 + ${springfox-version} + + + com.fasterxml.jackson.core + jackson-annotations + + + + + io.springfox + springfox-swagger-ui + ${springfox-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + junit + junit + ${junit-version} + test + + + jakarta.servlet + jakarta.servlet-api + ${servlet-api-version} + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + + org.springframework.data + spring-data-commons + 2.0.11.RELEASE + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + + + + 1.8 + UTF-8 + ${java.version} + ${java.version} + 1.3.5 + 2.3.3 + 9.2.15.v20160210 + 1.7.21 + 4.13.1 + 4.0.4 + 2.9.2 + 2.9.9 + 2.8.4 + 2.0.2 + 4.3.20.RELEASE + 2.9.8 + 1.6.3 + + diff --git a/samples/server/petstore/spring-mvc-spring-pageable/pom.xml b/samples/server/petstore/spring-mvc-spring-pageable/pom.xml new file mode 100644 index 000000000000..f506dc921acd --- /dev/null +++ b/samples/server/petstore/spring-mvc-spring-pageable/pom.xml @@ -0,0 +1,184 @@ + + 4.0.0 + org.openapitools + spring-mvc-spring-pageable + jar + spring-mvc-spring-pageable + 1.0.0 + + src/main/java + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty-version} + + + /v2 + + target/${project.artifactId}-${project.version} + 8079 + stopit + 10 + + 80 + 60000 + + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + + + + + start-jetty + pre-integration-test + + start + + + 0 + true + + + + stop-jetty + post-integration-test + + stop + + + + + + + + + org.slf4j + slf4j-log4j12 + ${slf4j-version} + + + + + org.springframework + spring-core + ${spring-version} + + + org.springframework + spring-webmvc + ${spring-version} + + + org.springframework + spring-web + ${spring-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + + + jakarta.xml.bind + jakarta.xml.bind-api + ${jakarta.xml.bind-version} + + + + io.springfox + springfox-swagger2 + ${springfox-version} + + + com.fasterxml.jackson.core + jackson-annotations + + + + + io.springfox + springfox-swagger-ui + ${springfox-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + junit + junit + ${junit-version} + test + + + jakarta.servlet + jakarta.servlet-api + ${servlet-api-version} + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + + org.springframework.data + spring-data-commons + 2.0.11.RELEASE + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + + + + 1.8 + UTF-8 + ${java.version} + ${java.version} + 1.3.5 + 2.3.3 + 9.2.15.v20160210 + 1.7.21 + 4.13.1 + 4.0.4 + 2.9.2 + 2.9.9 + 2.8.4 + 2.0.2 + 4.3.20.RELEASE + 0.2.2 + 2.9.8 + 1.6.3 + + diff --git a/samples/server/petstore/spring-mvc/pom.xml b/samples/server/petstore/spring-mvc/pom.xml new file mode 100644 index 000000000000..11d5b5e0f12f --- /dev/null +++ b/samples/server/petstore/spring-mvc/pom.xml @@ -0,0 +1,184 @@ + + 4.0.0 + org.openapitools + spring-mvc-server + jar + spring-mvc-server + 1.0.0 + + src/main/java + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty-version} + + + /v2 + + target/${project.artifactId}-${project.version} + 8079 + stopit + 10 + + 8002 + 60000 + + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + + + + + start-jetty + pre-integration-test + + start + + + 0 + true + + + + stop-jetty + post-integration-test + + stop + + + + + + + + + org.slf4j + slf4j-log4j12 + ${slf4j-version} + + + + + org.springframework + spring-core + ${spring-version} + + + org.springframework + spring-webmvc + ${spring-version} + + + org.springframework + spring-web + ${spring-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + + + jakarta.xml.bind + jakarta.xml.bind-api + ${jakarta.xml.bind-version} + + + + io.springfox + springfox-swagger2 + ${springfox-version} + + + com.fasterxml.jackson.core + jackson-annotations + + + + + io.springfox + springfox-swagger-ui + ${springfox-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + junit + junit + ${junit-version} + test + + + jakarta.servlet + jakarta.servlet-api + ${servlet-api-version} + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + + org.springframework.data + spring-data-commons + 2.0.11.RELEASE + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + + + + 1.8 + UTF-8 + ${java.version} + ${java.version} + 1.3.5 + 2.3.3 + 9.2.15.v20160210 + 1.7.21 + 4.13.1 + 4.0.4 + 2.9.2 + 2.9.9 + 2.8.4 + 2.0.2 + 4.3.20.RELEASE + 0.2.2 + 2.9.8 + 1.6.3 + + diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/pom.xml b/samples/server/petstore/springboot-beanvalidation-no-nullable/pom.xml index d974dfb05c93..fa2cbd46832f 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/pom.xml +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 4.8.1 diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java index 48ef9800a85c..b706f55e4689 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java index dcb4bbe9aec8..a58043f8dff3 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java index b445b1b20647..431235fb04c1 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-beanvalidation/pom.xml b/samples/server/petstore/springboot-beanvalidation/pom.xml index b442795a6c1a..c710d9759fbd 100644 --- a/samples/server/petstore/springboot-beanvalidation/pom.xml +++ b/samples/server/petstore/springboot-beanvalidation/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCat.java index 12019bba5e82..8d0b1135ec4f 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Cat.java index 2bf0cfd302c2..d5cfa8b05521 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-delegate-j8/pom.xml b/samples/server/petstore/springboot-delegate-j8/pom.xml index e24f3612c139..20041a983f60 100644 --- a/samples/server/petstore/springboot-delegate-j8/pom.xml +++ b/samples/server/petstore/springboot-delegate-j8/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 4.8.1 diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCat.java index 12019bba5e82..8d0b1135ec4f 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Cat.java index 2bf0cfd302c2..d5cfa8b05521 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-delegate/pom.xml b/samples/server/petstore/springboot-delegate/pom.xml index 13b776fb8647..da2888920496 100644 --- a/samples/server/petstore/springboot-delegate/pom.xml +++ b/samples/server/petstore/springboot-delegate/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 4.8.1 diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java index 12019bba5e82..8d0b1135ec4f 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java index 2bf0cfd302c2..d5cfa8b05521 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-implicitHeaders/pom.xml b/samples/server/petstore/springboot-implicitHeaders/pom.xml index 5a45336d131a..1a53e6ec0560 100644 --- a/samples/server/petstore/springboot-implicitHeaders/pom.xml +++ b/samples/server/petstore/springboot-implicitHeaders/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 4.8.1 diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java index 12019bba5e82..8d0b1135ec4f 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java index 2bf0cfd302c2..d5cfa8b05521 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-reactive/pom.xml b/samples/server/petstore/springboot-reactive/pom.xml index e2a6a67ea731..8bed5bcee58a 100644 --- a/samples/server/petstore/springboot-reactive/pom.xml +++ b/samples/server/petstore/springboot-reactive/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 4.8.1 diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java index 12019bba5e82..8d0b1135ec4f 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java index 2bf0cfd302c2..d5cfa8b05521 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/pom.xml b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/pom.xml index 0f49f3d9ed8c..2ce8cb200162 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/pom.xml +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 4.8.1 diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Cat.java index c512b2f15914..b6e782282f28 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Cat.java @@ -50,6 +50,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/pom.xml b/samples/server/petstore/springboot-spring-pageable-delegatePattern/pom.xml index 110302774bbb..9c49e4ac32e7 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/pom.xml +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 4.8.1 diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Cat.java index c512b2f15914..b6e782282f28 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Cat.java @@ -50,6 +50,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/pom.xml b/samples/server/petstore/springboot-spring-pageable-without-j8/pom.xml index d14aee60a32a..2c532f75ac6d 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/pom.xml +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 4.8.1 diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Cat.java index c512b2f15914..b6e782282f28 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Cat.java @@ -50,6 +50,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable/pom.xml b/samples/server/petstore/springboot-spring-pageable/pom.xml index d6fd4aa4d264..661a64e40fd8 100644 --- a/samples/server/petstore/springboot-spring-pageable/pom.xml +++ b/samples/server/petstore/springboot-spring-pageable/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 4.8.1 diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Cat.java index c512b2f15914..b6e782282f28 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Cat.java @@ -50,6 +50,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-useoptional/pom.xml b/samples/server/petstore/springboot-useoptional/pom.xml index f55e7f69e875..10f4aa611a65 100644 --- a/samples/server/petstore/springboot-useoptional/pom.xml +++ b/samples/server/petstore/springboot-useoptional/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 4.8.1 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 12019bba5e82..8d0b1135ec4f 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 @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { 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 2bf0cfd302c2..d5cfa8b05521 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 @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { 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 ae6abe025998..0b15720dbd08 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 @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-virtualan/pom.xml b/samples/server/petstore/springboot-virtualan/pom.xml index 6efcca9e2963..8c8ca65643c9 100644 --- a/samples/server/petstore/springboot-virtualan/pom.xml +++ b/samples/server/petstore/springboot-virtualan/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 4.8.1 diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCat.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCat.java index d9bf8904dc81..0512603faa29 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCat.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Cat.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Cat.java index e9f0eadb4b3e..4c523da550b3 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Cat.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Dog.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Dog.java index 555bc9c9ac72..d123f91d3f5f 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Dog.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot/pom.xml b/samples/server/petstore/springboot/pom.xml index 11c3dcec7d7b..63ecd8432c27 100644 --- a/samples/server/petstore/springboot/pom.xml +++ b/samples/server/petstore/springboot/pom.xml @@ -9,6 +9,7 @@ 1.8 ${java.version} ${java.version} + UTF-8 2.9.2 4.8.1 diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCat.java index 12019bba5e82..8d0b1135ec4f 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Cat.java index 2bf0cfd302c2..d5cfa8b05521 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) {